IsoWeeksInYear
IsoWeeksInYear 插件添加了 .isoWeeksInYear()
API,用于返回一个 number
类型的值,表示该年份的 ISO 周数。
TIP
此功能依赖于 IsLeapYear 插件。
javascript
var isoWeeksInYear = require('dayjs/plugin/isoWeeksInYear');
// import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear' // ES 2015
var isLeapYear = require('dayjs/plugin/is-leap-year'); // 依赖 isLeapYear 插件
// import isLeapYear from 'dayjs/plugin/isLeapYear' // ES 2015
dayjs.extend(isoWeeksInYear);
dayjs.extend(isLeapYear);
dayjs('2004-01-01').isoWeeksInYear(); // 53
dayjs('2005-01-01').isoWeeksInYear(); // 52