Specifying a custom Date Format string in FluentDatePicker #3535
ben-eirich
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
You can create your own <FluentDatePicker @bind-Value="@SelectedValue" Culture="@myCulture" />
@code
{
private DateTime? SelectedValue = DateTime.Today.AddDays(-2);
private System.Globalization.CultureInfo myCulture = (System.Globalization.CultureInfo)System.Globalization.CultureInfo.InvariantCulture.Clone();
protected override void OnInitialized()
{
myCulture.DateTimeFormat.ShortDatePattern = "dd-MMM-yyyy";
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am currently evaluating component libraries for a future project, and in general, FluentUI Blazor looks very good for us. But, many of the other control libraries allow a Date Format string to be specified in their DatePicker components, but unfortunately we can't do that in FluentUI.
My employer, a large pharmaceutical, is globally standardized on DD-MMM-YYYY as the date format (ie, 17-MAR-2025). Because we are extremely international, this date format allows us to use a single date format globally but also unambiguously. There can be no confusion about which number is the month and which number is the year, and this is very important.
I don't see a way to achieve that in FluentUI. I would love to know if there is a way.
I had briefly thought that this might be possible by creating a custom Culture. However, after trying to figure out how to do that, it now seems to me that it is not possible to create custom cultures in .NET because
CultureAndRegionInfoBuilder
was removed. So, for the moment it seems to be impossible.If there is not a way to achieve this, perhaps allowing custom date format strings is something that can be considered in V5?
Beta Was this translation helpful? Give feedback.
All reactions