我正在使用 chrome 浏览器(版本 92.0.4515.131)。
我发现对 JavaScript Intl 的支持在Chrome浏览器中无法正常运行。
const formattedDate = new Intl.DateTimeFormat('nb-NO', {
"year": "numeric",
"month": "2-digit",
"day": "2-digit"
}).format(new Date('2021-08-02'));
console.log(formattedDate);
因此,Chrome 给出了“08/02/2021”,而不是 Firefox 中预期的“02.08.2021”。
JavaScript 功能在ECMA和MDN中定义,用于浏览器兼容性。
为了在 Chrome 中正常工作,我们需要添加任何修改吗?