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

isoWeek overwrites year? #1550

Open
Helfull opened this issue Jun 24, 2021 · 2 comments
Open

isoWeek overwrites year? #1550

Helfull opened this issue Jun 24, 2021 · 2 comments

Comments

@Helfull
Copy link

Helfull commented Jun 24, 2021

Describe the bug
I am trying to get the start and end of a given iso week
e.g.:

Week start end
Week 22 May 31, 2021 June 6, 2021
Week 23 June 7, 2021 June 13, 2021
Week 24 June 14, 2021 June 20, 2021

Taken from https://www.epochconverter.com/weeks/2021

If i set my date like this

dayjs('21', 'YY').isoWeek(23)

i get back for startOf('isoWeek') the 01.06.2020 which does overwrite the year i set.

Expected behavior
Here is an example with assertions of what i expect
https://github.com/Helfull/dayjs-bug

Information

  • Day.js Version ^1.10.5
  • OS: osx
  • Nodejs
@okms
Copy link

okms commented Jan 3, 2022

I can confirm this behavior, which breaks parsing of weeks in 2021, 2027, 2032 etc

@rush86999
Copy link

I can also confirm this behavior.

Please be careful with isoWeek.

I need to review all my code because of this

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

3 participants