Hello support team,
So I checked a lot and it doesn't seem that anyone reported this
basically, I need to display the date in Arabic numbers which should look like your advertisement https://www.syncfusion.com/blazor-components/blazor-datepicker under the section called
Web accessibility
on my blazor component this is how it look like where doc is a data model class instance
<label for="first-name">تاريخ السريان</label> <SfDatePicker TValue="DateTime" @bind-Value="doc.EffectiveDate" Locale="ar" EnableRtl=true></SfDatePicker> <label for="first-name">تاريخ الانتهاء</label> <SfDatePicker TValue="DateTime" @bind-Value="doc.ExpiryDate" Locale="ar" EnableRtl=true></SfDatePicker> |
my program.cs contains the following for localization
builder.Services.Configure<RequestLocalizationOptions>(options => { var supportedCultures = new[] { new CultureInfo("ar") }; options.SupportedCultures = supportedCultures; options.SupportedUICultures = supportedCultures; options.DefaultRequestCulture = new RequestCulture(culture: "ar-eg", uiCulture: "ar-eg"); }); builder.Services.AddSingleton(typeof(ISyncfusionStringLocalizer), typeof(SyncfusionLocalizer)); builder.Services.AddSyncfusionBlazor(options => { options.EnableRtl = true; }); var app = builder.Build(); app.UseRequestLocalization("ar"); |
right now I have a gird with paging where the paging is displaying the numbers correctly
this is syncfusion componenet so I didn't really need to do anything to turn the paging to arabic other than configuring the locale in program.cs
however when it came to the datepicker is throwing an exception in the browser
blazor.server.js:1 [2023-01-19T15:35:56.002Z] Error: System.AggregateException: One or more errors occurred. (String '19/1/2023 4:35:51 م' was not recognized as a valid DateTime.) ---> System.FormatException: String '19/1/2023 4:35:51 م' was not recognized as a valid DateTime. at Syncfusion.Blazor.Calendars.SfDatePicker`1.ValueString() at Syncfusion.Blazor.Calendars.SfDatePicker`1.GetClientProperties() at Syncfusion.Blazor.Calendars.SfDatePicker`1.OnAfterScriptRendered() at Syncfusion.Blazor.SfBaseComponent.OnAfterRenderAsync(Boolean firstRender) at Syncfusion.Blazor.Inputs.SfInputTextBase`1.OnAfterRenderAsync(Boolean firstRender) at Syncfusion.Blazor.Calendars.SfDatePicker`1.OnAfterRenderAsync(Boolean firstRender) --- End of inner exception stack trace --- |
I can see the date picker on the screen and it is displaying the date but due to this error I am unable to interact with the page
I am not sure if something is missing for the date picker to work as it works perfectly fine if I disabled the locale from program.cs and turn everything to English
Thank you for your support
Our Syncfusion components worked based on the system culture or the culture configured in the application globally. So, setting the culture for specific components rendered on different pages within the same application is not possible. Also, we apologize for maintaining outdated content in the Documentation section. We have deprecated this documentation code in the 18.1.42 version. Please find below the release notes for your reference.
Release Notes: https://blazor.syncfusion.com/documentation/release-notes/18.1.42?type=all#common
Now, we are using resource files to fetch the different culture locale values through dependency injection (DI) in the application. Please see the documentation below for your convenience.
Documentation: https://blazor.syncfusion.com/documentation/common/localization
We have prepared a sample and shared it below for your reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/culture141258385
Also, we will correct our documentation and refresh the live link as soon as possible.
Hello
UdhayaKumar Duraisamy ,
Thank you very much for your response.
After long time of inspecting and replicating your project I come to realize that your latest datepicker works perfectly fine when the project target framework "net7.0" while my project was "net6.0"
regards,
Thanks for the update. Please get back to us if you need any further assistance on this.