Bug : Incorrect DatePicker "fa-IR" Culture #1482

Open
opened 2026-01-29 17:54:15 +00:00 by claunia · 3 comments
Owner

Originally created by @NabaviFard-Mahdi on GitHub (Nov 16, 2024).

Describe the bug
DatePicker In "fa-IR" Cluture Dos not work correct
when select "today" date the inutbox show corrected date but the calendar dos not show correct
when select current date in calendar , the inputbbox dos not show correct date

To Reproduce

  1. Add Persian Culture in Program.cs
// Configure Persian culture
var persianCulture = new CultureInfo("fa-IR");
persianCulture.DateTimeFormat.Calendar = new PersianCalendar();
CultureInfo.DefaultThreadCurrentCulture = persianCulture;
CultureInfo.DefaultThreadCurrentUICulture = persianCulture;
builder.Services.Configure<RequestLocalizationOptions>(options =>
{
    var supportedCultures = new[]
    {
        persianCulture
    };
    options.DefaultRequestCulture = new RequestCulture("fa-IR");
    options.SupportedCultures = supportedCultures;
    options.SupportedUICultures = supportedCultures;
});
  1. add demo RadzenDatepicker in index.razor
<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" AlignItems="AlignItems.Center" Gap="0.5rem" class="rz-p-12">
    <RadzenLabel Text="Select Date" Component="DatePickerHourFormat" />
    <RadzenDatePicker @bind-Value=@value ShowTime="true" HourFormat="12" DateFormat="MM/dd/yyyy h:mm tt" Name="DatePickerHourFormat" />
</RadzenStack>


<RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" AlignItems="AlignItems.Center" Gap="0.5rem" class="rz-p-12">
    <RadzenLabel Text="Select Date" Component="DatePickerFooterTemplate" />
    <RadzenDatePicker @bind-Value=@value Name="DatePickerFooterTemplate">
        <FooterTemplate>
            <RadzenButton Click=@(args => value = DateTime.Now) Text="Today" Style="width: 100%;" class="rz-my-4" />
        </FooterTemplate>
    </RadzenDatePicker>
</RadzenStack>
  1. run and test

Expected behavior
correct show date in "fa-IR" culture

Screenshots
2
2-2
peek_3

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome Version 130.0.6723.117 (Official Build) (64-bit)
  • Version Radzen v5.6.1
  • Dotnet 8.0.403

Additional context

Originally created by @NabaviFard-Mahdi on GitHub (Nov 16, 2024). **Describe the bug** DatePicker In "fa-IR" Cluture Dos not work correct when select "today" date the inutbox show corrected date but the calendar dos not show correct when select current date in calendar , the inputbbox dos not show correct date **To Reproduce** 1) Add Persian Culture in Program.cs ```c# // Configure Persian culture var persianCulture = new CultureInfo("fa-IR"); persianCulture.DateTimeFormat.Calendar = new PersianCalendar(); CultureInfo.DefaultThreadCurrentCulture = persianCulture; CultureInfo.DefaultThreadCurrentUICulture = persianCulture; builder.Services.Configure<RequestLocalizationOptions>(options => { var supportedCultures = new[] { persianCulture }; options.DefaultRequestCulture = new RequestCulture("fa-IR"); options.SupportedCultures = supportedCultures; options.SupportedUICultures = supportedCultures; }); ``` 2) add demo RadzenDatepicker in index.razor ```c# <RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" AlignItems="AlignItems.Center" Gap="0.5rem" class="rz-p-12"> <RadzenLabel Text="Select Date" Component="DatePickerHourFormat" /> <RadzenDatePicker @bind-Value=@value ShowTime="true" HourFormat="12" DateFormat="MM/dd/yyyy h:mm tt" Name="DatePickerHourFormat" /> </RadzenStack> <RadzenStack Orientation="Orientation.Horizontal" JustifyContent="JustifyContent.Center" AlignItems="AlignItems.Center" Gap="0.5rem" class="rz-p-12"> <RadzenLabel Text="Select Date" Component="DatePickerFooterTemplate" /> <RadzenDatePicker @bind-Value=@value Name="DatePickerFooterTemplate"> <FooterTemplate> <RadzenButton Click=@(args => value = DateTime.Now) Text="Today" Style="width: 100%;" class="rz-my-4" /> </FooterTemplate> </RadzenDatePicker> </RadzenStack> ``` 3) run and test **Expected behavior** correct show date in "fa-IR" culture **Screenshots** ![2](https://github.com/user-attachments/assets/8fba375d-8eff-4a7a-bbf4-5e8077211eb6) ![2-2](https://github.com/user-attachments/assets/b26eab98-c7d8-4b9f-a332-d75f18117bf7) ![peek_3](https://github.com/user-attachments/assets/1096cd73-7c6e-4256-bf41-5c09283ac597) **Desktop (please complete the following information):** - OS: Windows 10 - Browser Chrome Version 130.0.6723.117 (Official Build) (64-bit) - Version Radzen v5.6.1 - Dotnet 8.0.403 **Additional context**
Author
Owner

@enchev commented on GitHub (Nov 21, 2024):

We are not familiar with "fa-IR" culture and Persian calendar, feel free to submit pull request.

@enchev commented on GitHub (Nov 21, 2024): We are not familiar with "fa-IR" culture and Persian calendar, feel free to submit pull request.
Author
Owner

@Saffarnejad commented on GitHub (Dec 17, 2024):

@NabaviFard-Mahdi
According to the first image:
The Gregorian date is equal to the 16th day and the 11th month.
The value displayed in the text box is correct because the date above is equal to the 26th day and the 8th month of the solar calendar.
But there is a problem in the DatePicker. Because the 16th day of the 11th month (Bahman) of the solar calendar is selected.

A solution must be found to set the default DatePicker to the Gregorian equivalent.

@Saffarnejad commented on GitHub (Dec 17, 2024): @NabaviFard-Mahdi According to the first image: The Gregorian date is equal to the 16th day and the 11th month. The value displayed in the text box is correct because the date above is equal to the 26th day and the 8th month of the solar calendar. But there is a problem in the DatePicker. Because the 16th day of the 11th month (Bahman) of the solar calendar is selected. A solution must be found to set the default DatePicker to the Gregorian equivalent.
Author
Owner

@NabaviFard-Mahdi commented on GitHub (Jan 14, 2025):

@Saffarnejad
Yes, that's right
I tried to fix it once but it didn't work, now I'll try again at another opportunity
If you can fix this problem or do you have a solution to fix it?

@NabaviFard-Mahdi commented on GitHub (Jan 14, 2025): @Saffarnejad Yes, that's right I tried to fix it once but it didn't work, now I'll try again at another opportunity If you can fix this problem or do you have a solution to fix it?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1482