Why Doesn't Intl.numberformat Work With Units In Safari And Firefox?
Solution 1:
The problem comes from the value unit
of the style
field.
According to ECMA-402, 6th edition, June 2019 ECMAScript® 2019 Internationalization API Specification:
The value of this field must be a record, which must have fields with the names of the three number format styles: "decimal", "percent", and "currency".
According to the Draft ECMA-402 / February 27, 2020 ECMAScript® 2020 Internationalization API Specification:
The value of this field must be a Record, which must have fields with the names of the four number format styles: "decimal", "percent", "currency", and "unit".
Firefox and Safari are implementing the 6th edition of the ECMA-402 specification and Chrome is implementing the Draft version of this same specification. The draft specification can change at any time and there is no formal guarantees that this new unit
value will be included in the 7th edition. If you want to be cross-browser compatible and future-proof, you should stick on the 6th edition and wait for the release of the 7th edition before using these new features.
If you want details you can read the proposition for this new feature.
Post a Comment for "Why Doesn't Intl.numberformat Work With Units In Safari And Firefox?"