为什么 Intl.NumberFormat 不能在 Safari 和 Firefox 中使用单位?

Why doesn't Intl.NumberFormat work with units in Safari and Firefox?

我正在尝试使用 here 给出的有关格式化数字的示例。

console.log((16).toLocaleString('en-GB', {
    style: "unit",
    unit: "liter",
    unitDisplay: "long"
}));

我在 chrome 中尝试过,效果很好。但是,在 Safari 和 Firefox 中,我分别收到以下错误 Error: style must be either "decimal", "percent", or "currency"Error: invalid value "unit" for option style

在查看浏览器兼容性后,我认为它应该适用于所有浏览器。我尝试寻找答案,但找不到有关此问题的任何信息。有谁知道这是为什么,或者我在哪里可以找到更多信息?

问题来自 style 字段的值 unit

根据 ECMA-402,第 6 版,2019 年 6 月 ECMAScript® 2019 国际化 API 规范

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".

根据 ECMA-402 草案/2020 年 2 月 27 日 ECMAScript® 2020 国际化 API 规范

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 和 Safari 正在实施第 6 版 ECMA-402 规范,Chrome 正在实施同一规范的草案版本。规范草案随时可能更改,并且没有正式保证这个新的 unit 值将包含在第 7 版中。如果你想跨浏览器兼容和面向未来,你应该坚持使用第 6 版并等待第 7 版的发布,然后再使用这些新功能。

如果您需要详细信息,可以阅读 proposition for this new feature