Replies: 3 comments 1 reply
-
The locale provides a lot of config settings beyond just the date/time formats, including month & weekday names, AM/PM translations, number formatting info, and the localized currency code. So Craft definitely needs to know which locale to pull all that info from. That said, you could override tho formatter config function from return [
'components' => [
'formatter' => function() {
$formatter = Craft::$app->getLocale()->getFormatter();
$formatter->dateTimeFormats = [
'short' => [
'date' => 'y-MM-dd',
'time' => 'hh:mm:ss',
'datetime' => 'y-MM-ddThh:mm:ss',
],
'medium' => [
'date' => 'y-MM-dd',
'time' => 'hh:mm:ss',
'datetime' => 'y-MM-ddThh:mm:ss',
],
'long' => [
'date' => 'y-MM-dd',
'time' => 'hh:mm:ss',
'datetime' => 'y-MM-ddThh:mm:ss',
],
'full' => [
'date' => 'y-MM-dd',
'time' => 'hh:mm:ss',
'datetime' => 'y-MM-ddThh:mm:ss',
],
];
return $formatter;
},
]
]; |
Beta Was this translation helpful? Give feedback.
-
Ahh, that's good to know! I wouldn't mind seeing a less general GUI for individual preferences at some point, but for now, a Although... how would said override interact with other users' preferences? |
Beta Was this translation helpful? Give feedback.
-
Hm good question, I guess there’s not really a way to factor that in right now. |
Beta Was this translation helpful? Give feedback.
-
Description
The Formatting Locale in account preferences lists formats by country:
However, no country has adopted the only format that completely eliminates ambiguity, ISO 8601.
Can we please have a formatting option for ISO 8601?
Beta Was this translation helpful? Give feedback.
All reactions