Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YYYY-WW format of 29 Dec 2019 is 2019-01 #2620

Open
fengelniederhammer opened this issue Apr 4, 2024 · 0 comments
Open

YYYY-WW format of 29 Dec 2019 is 2019-01 #2620

fengelniederhammer opened this issue Apr 4, 2024 · 0 comments

Comments

@fengelniederhammer
Copy link

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant