datetime-local input uses incorrect date/time format
Categories
(Core :: DOM: Forms, defect)
Tracking
()
People
(Reporter: jakub, Unassigned)
Details
Attachments
(2 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0
Steps to reproduce:
Have a system with Windows 10, with English UI and Polish regional settings.
Go to the documetation for <input type="datetime-local"> (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local).
Look at the demo at the top of the page.
Actual results:
The input in the demo uses "MM/dd/yyyy hh:mm am/pm" date/time format.
Expected results:
The documentation states "the displayed date and time are formatted according to the user's locale as reported by their operating system", so I expected Firefox to use my regional settings from Windows to format the date/time in the input.
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Form Controls' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
Updated•4 years ago
|
Comment 2•4 years ago
|
||
Emilio, can you please confirm what the expected format is? Thanks.
FWIW, on my other computer, using Linux Mint and also Polish regional settings, Firefox correctly formats the date/time according to the regional format, exactly as I expected based on the specs.
Comment 4•4 years ago
|
||
The locale settings are the same as for <input type=date> right?
The locales are chosen here, which end up here.
The settings may come from the OS but that depends on a variety of settings (intl.regional_prefs.use_os_locales seems the relevant one here). Does changing that pref in about:config change the locales that gets chosen?
Yes, changing intl.regional_prefs.use_os_locales to true caused my regional settings from Windows to be applied.
One additional thing I discovered: changing Firefox UI language (not the language for displaying pages - changing this one seems to have no effect on this issue) to Polish made it work, even without touching intl.regional_prefs.use_os_locales.
So it just seems with intl.regional_prefs.use_os_locales set to false it just uses Firefox UI language.
I don't know if this is a correct behavior, or maybe my setup is not typical (English OS and Firefox UI for work reasons, but Polish regional settings) and needs me tweaking intl.regional_prefs.use_os_locales. However, the specs explicitly say "the displayed date and time are formatted according to the user's locale as reported by their operating system", so this seems like a bug to me.
Comment 6•4 years ago
|
||
(In reply to jakub from comment #5)
I don't know if this is a correct behavior, or maybe my setup is not typical (English OS and Firefox UI for work reasons, but Polish regional settings) and needs me tweaking
intl.regional_prefs.use_os_locales. However, the specs explicitly say "the displayed date and time are formatted according to the user's locale as reported by their operating system", so this seems like a bug to me.
Where in the spec is this? Note that MDN is not the spec. The spec is https://html.spec.whatwg.org/#local-date-and-time-state-(type=datetime-local) (and it doesn't say anything about localization afaict).
In any case. Zibi, do you know why is use_os_locales false by default? Seems you were involved in bug 1379910 which introduced it.
Also, it seems like it's not accessible from my nightly's about:preferences, but perhaps it's supposed to?
You are right, calling it a "spec" was a stretch. Regardless, MDN seems to be quite specific here and I expected Firefox to behave according to that description :-)
The intl.regional_prefs.use_os_locales seems to affect more than just locale of form elements, e.g. it also changed the dates/times display in Firefox history, which is really nice and I think would be a great out-of-the-box experience, see the ff-history-regional-settings.png file I've attached.
Comment 9•4 years ago
|
||
In any case. Zibi, do you know why is use_os_locales false by default?
It's disabled by default because we believe majority of users prefer consistency between their browser locale and regional preferences, than between OS regional preferences and browser regional preferences in cases where those two are at odds.
This is an opinion and we recognize that others may come to different conclusion.
For background - https://firefox-source-docs.mozilla.org/intl/locale.html#regional-preferences
Comment 10•4 years ago
|
||
Ok, it seems this is working as designed then. The only remaining question is, why doesn't it appear on about:preferences (on my nightly at least)?
Updated•4 years ago
|
Description
•