dayjs
dayjs copied to clipboard
`YYYY-WW` format of 29 Dec 2019 is `2019-01`
Describe the bug
import dayjs from 'dayjs/esm';
import isoWeek from 'dayjs/esm/plugin/isoWeek';
import advancedFormat from 'dayjs/esm/plugin/advancedFormat';
dayjs.extend(isoWeek);
dayjs.extend(advancedFormat);
const firstDay = dayjs().year(2020).month(1).date(4).isoWeek(1).startOf('isoWeek');
firstDay.toString(); // Sun, 29 Dec 2019 23:00:00 GMT - that seems ok
firstDay.format('YYYY-WW'); // 2019-01 - this is definitely not correct.
Expected behavior
YYYY-WW
of 29 Dec 2019
should be 2020-01
(according to https://www.epochconverter.com/weeks/2019)
Information
- Day.js Version 1.11.10
- OS: Ubuntu
- Browser none/Node
- Time zone: CEST (UTC +2)