Hi all,

We completed the transition of the Intl handling from using OS locale, to use 
browser UI locale.

We have a new API called mozIntl.DateTimeFormat which should be the primary way 
we format date and time in our chrome.
You can think of it as a regular ECMA402 DateTimeFormat on steroids.

It gives us two "shorthand" options "dateStyle" and "timeStyle" which you can 
use instead of listing manually all options. This should lead to increased 
consistency of our UI. On top of that, those two options allow us to tap into 
OS regional settings to read any manual adjustments user made and respect them.

Imagine that the user changed time format from hour12 to hour24. 
mozIntl.DateTimeFormat will respect that and show the time in the current UI 
locale, but with this adjustment.

This step is crucial for better product localizability (because now the dates 
are in the same language as the rest of UI - think "Today is: April 5th" where 
"April 5th" comes from date formatting and "Today is:" from l10n - we want both 
to be in one language).

Example of how to use the new API:

```

let dtf = mozIntl.createDateTimeFormat(undefined, {
  dateStyle: 'long', // full | long | medium | short
  timeStyle: 'medium // full | long | medium | short
});

dtf.format(now);

```

Please, use the new API for all new code and when possible, migrate old code to 
use it.

Thanks!
zb.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to