首页 > 解决方案 > 为什么 Intl.DateTimeFormat 根据年份在 Safari 中返回不同的月份?

问题描述

new Intl.DateTimeFormat('en-US', {'month': 'short'}).format(new Date(2007, 3));
> "Apr"

new Intl.DateTimeFormat('en-US', {'month': 'short'}).format(new Date(2006, 3));
> "Mar"

new Intl.DateTimeFormat('en-US', {'month': 'short'}).format(new Date(2007, 10));
> "Nov"

new Intl.DateTimeFormat('en-US', {'month': 'short'}).format(new Date(2006, 10));
> "Oct"

苹果浏览器Version 11.1 (13605.1.33.1.4)

在 Chrome 中,它返回我所期望的(Apr、Apr、Nov、Nov)。

标签: datesafari

解决方案


推荐阅读