Spec
https://github.com/tc39/ecma402/pull/175
https://github.com/tc39/ecma402/pull/349
https://github.com/tc39/ecma402/pull/351
Summary
All three ECMA402 PRs reach consensus from both ECMA402 committee late Sept and TC39 in Oct. These three PRs make the pre-existing Intl.DateTimeFormat to specify different "calendar" via option (instead of appending the calendar as "-u-ca-$calendar" in locale) and make the Intl.DateTimeFormat choose the pattern accordingly. It also change the formatToParts method to output "relatedYear" or "yearName" type for some non-gregorian calendar (such as Chinese calendar) while both the Chinese calendar year name and the gregorian year name are displayed based on the pattern.
It also let Intl.DateTimeFormat and Intl.NumberFormat take numberingSystem from options (instead of appending "-u-nu-$numberingSystem" in locale).
let o = new Intl.DateTimeFormat("en" , { calendar: "chinese", year: "numeric" }); console.log(o.format(Date.now())); // "2019(ji-hai)" console.log(o.formatToParts(Date.now())); // [{type: "relatedYear", value: "2019"}, // {type: "literal", value: "("}, // {type: "yearName", value: "ji-hai"}, // {type: "literal", value: ")"}] let n = new Intl.NumberFormat("en" , { numberingSystem: "thai" }); console.log(n.format(1234567890)); // "๑๒๓,๔๕๖,๗๘๙" |
Interoperability and compatibility risk
The options "numberingSystem" added to Intl.DateTimeFormat and Intl.NumberFormat is already supported by Intl.Locale and Intl.RelativeTimeFormat with the same meaning. The options "calendar" added to Intl.DateTimeFormat is already supported by Intl.Locale with the same meaning. The risk to break pre-existing javascript code is low.
Firefox: No public signals
Edge: No public signals
Safari:No public signals
Web Developers:No signals
Is this feature fully tested?
Yes; our implementation passes our own V8 tests for all the features.
test/intl/number-format/check-numbering-system.js
Tracking bug
Link to entry on the Chrome Platform Status dashboard
https://www.chromestatus.com/features/5440249461211136
Requesting approval to ship?
Yes. Note that since this is a V8/JS feature, this post is just an FYI to blink-dev — no signoff from Blink API owners is required.
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOcELL8iJdVbwNWBhdU-1HiNVqp4pQm_C1CfrF6D%3DHvWWPdN9w%40mail.gmail.com.