IsoWeeksInYear
IsoWeeksInYear は、.isoWeeksInYear()
API を追加し、ISO 週の規則に従って、その年の週数を number
型で返します。
TIP
この機能を使用するには、IsLeapYear プラグインが必須です。
javascript
var isoWeeksInYear = require('dayjs/plugin/isoWeeksInYear');
// import isoWeeksInYear from 'dayjs/plugin/isoWeeksInYear' // ES 2015
var isLeapYear = require('dayjs/plugin/isLeapYear'); // 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