[dom] Read-only OS time formatting preferences
Zibi Braniecki via GitHub <[email protected]> Mon, 21 Sep 2015 08:20:47 +0000
| Newsgroups | gmane.comp.web.dom.general |
|---|---|
| Message-ID | <[email protected]> |
zbraniecki has just created a new issue for
https://github.com/whatwg/dom:
== Read-only OS time formatting preferences ==
All operating systems allow user to select time format. Usually
between 12h, 24h or follow automatic.
Firefox OS is currently providing `navigator.mozHour12` that can take
true/false/undefined values and that nicely fits into Intl API:
```
(new Date()).toLocaleString(navigator.languages, {
hour12: navigator.mozHour12,
hour: 'numeric',
minute: 'numeric'
});
```
When "use default" is used, `mozHour` is undefined and Intl uses the
default `hour12` value for the given locale. If `mozHour` is specified
to either `true` or `false`, Intl API follows that.
There's also an event associated with it: `timeformatchange` that is
dipatched on `window`.
See https://github.com/whatwg/dom/issues/79