Closed Bug 1166359 Opened 9 years ago Closed 2 years ago

Date.prototype.toLocaleTimeString() ignores system hour12 preference on Windows


(Core :: JavaScript: Internationalization API, defect)

40 Branch
Not set





(Reporter: ohnobinki, Unassigned)



User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:40.0) Gecko/20100101 Firefox/40.0
Build ID: 20150519004002

Steps to reproduce:

Rendered a Date()’s time component with its toLocaleTimeString() method.

Actual results:

I got something that looked like “8:00:00 PM”.

Expected results:

To have it respect the locale’s 24hour setting ( ) , like Mobile Safari on iOS-6.1.6 (and 8) does and IE11 does . I think the default loaded locale should properly 

And a side issue: as a web developer, if I’m writing a dynamic server-side script, how can I tell what the user’s hour12 preference is? If the fix for this toLocaleTimeString() bug extends the BCP47 string within the implementation (as argued about in the FFOS bug #903683 comment 32), it’d be easier for everyone, both client-side and server-side script developers, to respect users’ preferences. Also, in terms of locale loading and passing locale names around, it seems like being able to do `new Intl.DateTimeFormat([someDateTimeFormat.resolvedOptions().locale])` and not lose the hour12 preference makes sense, especially when the browser is not the only thing formatting dates/times. But, please, disregard this paragraph if considered out of the scope of this bug.
Sorry, the FireFox screenshot link under “Actual Results” should be:
We don't currently follow OS preferences. This depend on bug 1308329.

For operations on locale string, see
Depends on: 1308329
Component: General → JavaScript: Internationalization API
With bug 1308329 RESOLVED FIXED in Firefox 54: please, what next should happen with this bug 1166359?
This should be resolved for Firefox UI date/time formatting. If the locale of your OS matches the locale of Firefox, we should follow hourCycle of the OS.

For websites, we cannot do that because that would leak our settings and pose a fingerprint vector.
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.