Cms: Localizable DateFieldtype

Created on 13 May 2019  路  7Comments  路  Source: statamic/cms

We'd love to re-use your DateFieldtype, wrapped by a Vue component to deal with Unix timestamps. For that, we would need to be able to set the localization of the displayed date to German: Instead of "March 6, 2009" we'd need "6. M盲rz 2009" or at least "06.03.2009" (which should be easier to enable for you, since we'd only have to pass a format string while keeping US localization).

Most helpful comment

New Date fieldtype is now on master. It respects the locale setting in config/app.php so you get this right out of the box:

image

All 7 comments

To render the same string in the index, a way to format the timestamp to a German date would also be needed in PHP. :)

I have a new date fieldtype in the works on feature/v-calendar that has a _lot_ more flexibility around date formats and masking. I'm quite sure we can work this out.

New Date fieldtype is now on master. It respects the locale setting in config/app.php so you get this right out of the box:

image

That sounds awesome, I'll be testing it tomorrow! Thanks a lot!

Uhmm... Are we supposed to use DateFieldtype and TimeFieldtype separately now? If so, why does DateFieldtype still emit updates as .format('YYYY-MM-DD HH:mm')? 馃檭

Ah my mistake. Reopening and bringing the time field back inside 馃槀 Got a little over zealous.

There we go. Fixed in defdfb8e.

Was this page helpful?
0 / 5 - 0 ratings