IsoWeeksInYear
IsoWeeksInYear 增加了 .isoWeeksInYear()
API 返回一个 number
来得到依据 ISO week 标准一年中有几周
这依赖
IsLeapYear
插件,才能正常运行
var isoWeeksInYear = require("dayjs/plugin/isoWeeksInYear");
// import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear' // ES 2015
var isLeapYear = require("dayjs/plugin/isLeapYear"); // dependent on isLeapYear plugin
// 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