Default Date Formats

Hi
I have set my app settings to use en-GB for my locale. I can see the locale code in startup.cs

I also have my dev box configured for UK region, default short date format is dd/MM/yyyy

  1. In the designer, If I goto the data option and Infer schema and create crud pages the page date format defaults to MM/dd/yyyy. Why? I don't use this format anywhere, surely this should at least come from locale PC region settings in the first instance or via the locale settings. If I change it it doesn't get saved, it keeps defaulting back to MM/dd/yyy which is a pain when creating pages as its easy to overlook. Leaving it blank causes inconsistent formats across page types.

  2. I would like my dates to globally adopt a setting, makes sense to be short date format d .
    If its left blank in the formatting property I would expect is to assume a short date format for example - however the date then appears as YYYY-mm-dd format, where did that come from?

  3. It seems to differ between the crud table pages and the add/edit pages. If I create a new set of crud pages the grid page will show a default format different to the add/edit page, related to 1 I think.

  4. As a result I have to do through and manually change all of my date formats to my choice, dates appear everywhere, it s a project that's getting larger each day and it will take a while :frowning: Ideally I want them cleared out and default to a common default and then on a case by case basis tweak any where I need a different format.

Any suggestions for setting a consistent global data format for existing and new pages?

Thanks
Tim

Update: I went through the .json files and removed all date formatting and rebuilt app.
As an example, you can see the different formatting at runtime between the edit page, the grid view page in the background and the d format dd/MM/yyyy for the dev box/server its running on. (don't know if browser location plays a part in the formatting based on where it thinks you are?)

If I goto the data option and Infer schema and create crud pages the page date format defaults to MM/dd/yyyy. Why?

This is the default date format we have picked. No particular reason apart from it being the default date format in the US (and by virtue in .NET / Angular).

however the date then appears as YYYY-mm-dd format, where did that come from

We may indeed change the date format of the DatePicker at some point.

It seems to differ between the crud table pages and the add/edit pages

Specifying a date format is possible only in the CRUD wizard. Add/edit pages act as if no date format is specified.

Any suggestions for setting a consistent global data format for existing and new pages?

The option in the CRUD pages configuration is the only possible option at the moment.

Thanks
Maybe its possible to at least save the setting chosen when building the crud pages?

It's a great product and it's great to see it improving almost every day but these issues are a pain for non USA developers and users

Cheers
Tim

2 Likes

I have a very similiar problem in my angular app, I am not sure if this is the same for blazor.

But maybe it would help if the dateFormat-attribute/property in in the generated files could be written always, even if it isn't configured.

So you could just find and replace "MM/dd/yyyy" with eg "yy-mm-dd" in all your project files?
This would have to be done only once per new crud-page creation, which would be much easier than changing the setting for every control by hand.

Completely agree with @timt and @Moo on this. We need to have an option of setting the date format once and for all in Radzen tool or atleast have it pick from the system settings. We use dd/MM/YYYY here and changing it every time seems pointless.

image

image
:laughing:

2 Likes