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