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

weekOfYear shows wrong calender week at the turn of the year #1264

Closed
ttusek opened this issue Dec 9, 2020 · 11 comments · Fixed by backstage/backstage#4967
Closed

weekOfYear shows wrong calender week at the turn of the year #1264

ttusek opened this issue Dec 9, 2020 · 11 comments · Fixed by backstage/backstage#4967
Assignees
Labels
☢️Bug Something isn't working released

Comments

@ttusek
Copy link

ttusek commented Dec 9, 2020

Describe the bug
The 2020-12-30 should be calender week 53 but it shows as calender week 1.
(similar issue: #760)

Calender weeks:
http://www.whatweekisit.org/

Information

Day.js Version 1.9.7
Browser Chrome latest

@iamkun
Copy link
Owner

iamkun commented Dec 9, 2020

Hi, have you set the correct locale?

@ttusek
Copy link
Author

ttusek commented Dec 9, 2020

yes, it is the same issue when i set 'us' | 'de'
https://codepen.io/tompach/pen/OJRRpNE?editors=0012

@ChuanfengZhang
Copy link

@iamkun I have the same issue.
https://codepen.io/Chuanfeng/pen/PoGBwrp?editors=0002

@iamkun
Copy link
Owner

iamkun commented Jan 8, 2021

You can use en-gb locale to get the correct result ATM.

will update some other locale like en-us, de to set correct year star day.

@iamkun iamkun self-assigned this Jan 8, 2021
@iamkun iamkun added the ☢️Bug Something isn't working label Jan 8, 2021
@Uninen
Copy link

Uninen commented Jan 8, 2021

I have this same issue. Using en-gb as locale doesn't seem to fix it. Can't get to week 53 with any locale I've tried.

@iamkun
Copy link
Owner

iamkun commented Jan 8, 2021

@Uninen a reproduction demo please? you can share your code here https://runkit.com/npm/dayjs

@Uninen
Copy link

Uninen commented Jan 8, 2021

Sure, here: https://runkit.com/embed/5wk28cq51vf9

(Note, the dates here are dynamic so this example may or may not work in the future.)

Week for Mon Dec 28 2020 returns 1 (should be 53), week for Sun Jan 10 2021 returns 3 (should be 1) using locale en-gb.

@iamkun
Copy link
Owner

iamkun commented Jan 8, 2021

@Uninen this is because you haven't load en-gb locale https://day.js.org/docs/en/i18n/loading-into-nodejs

@Uninen
Copy link

Uninen commented Jan 8, 2021

Oh! 🤦‍♂️ Thanks, it works with en-gb locale when the locale is properly set.

Sorry about the noise. I missed the import as there were no errors or even TypeScript hints with the locale-call even though it wasn't imported.

@iamkun iamkun closed this as completed in 1858df8 Jan 9, 2021
iamkun pushed a commit that referenced this issue Jan 9, 2021
## [1.10.3](v1.10.2...v1.10.3) (2021-01-09)

### Bug Fixes

* fix customParseFormat plugin strict mode parse meridiem bug ([#1321](#1321)) ([e49eeef](e49eeef))
* fix weekYear plugin missing locale bug ([#1319](#1319)) ([344bdc0](344bdc0)), closes [#1304](#1304)
* update advancedFormat plugin to add format options for iso week and weekyear ([#1309](#1309)) ([2c54c64](2c54c64))
* update devHelper to add dev warning setting locale before loading ([c5cc893](c5cc893))
* update German [de] locale yearStart ([1858df8](1858df8)), closes [#1264](#1264)
@iamkun
Copy link
Owner

iamkun commented Jan 9, 2021

🎉 This issue has been resolved in version 1.10.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@iamkun iamkun added the released label Jan 9, 2021
@ChuanfengZhang
Copy link

@iamkun What about the default locale en?
https://runkit.com/zhangcf/5ffbb211b8e405001f893751

andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.10.3](iamkun/dayjs@v1.10.2...v1.10.3) (2021-01-09)

### Bug Fixes

* fix customParseFormat plugin strict mode parse meridiem bug ([#1321](iamkun/dayjs#1321)) ([e49eeef](iamkun/dayjs@e49eeef))
* fix weekYear plugin missing locale bug ([#1319](iamkun/dayjs#1319)) ([344bdc0](iamkun/dayjs@344bdc0)), closes [#1304](iamkun/dayjs#1304)
* update advancedFormat plugin to add format options for iso week and weekyear ([#1309](iamkun/dayjs#1309)) ([2c54c64](iamkun/dayjs@2c54c64))
* update devHelper to add dev warning setting locale before loading ([c5cc893](iamkun/dayjs@c5cc893))
* update German [de] locale yearStart ([1858df8](iamkun/dayjs@1858df8)), closes [#1264](iamkun/dayjs#1264)
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.10.3](iamkun/dayjs@v1.10.2...v1.10.3) (2021-01-09)

### Bug Fixes

* fix customParseFormat plugin strict mode parse meridiem bug ([#1321](iamkun/dayjs#1321)) ([e49eeef](iamkun/dayjs@e49eeef))
* fix weekYear plugin missing locale bug ([#1319](iamkun/dayjs#1319)) ([344bdc0](iamkun/dayjs@344bdc0)), closes [#1304](iamkun/dayjs#1304)
* update advancedFormat plugin to add format options for iso week and weekyear ([#1309](iamkun/dayjs#1309)) ([2c54c64](iamkun/dayjs@2c54c64))
* update devHelper to add dev warning setting locale before loading ([c5cc893](iamkun/dayjs@c5cc893))
* update German [de] locale yearStart ([1858df8](iamkun/dayjs@1858df8)), closes [#1264](iamkun/dayjs#1264)
splashwizard pushed a commit to splashwizard/tracking-time that referenced this issue Oct 21, 2024
## [1.10.3](iamkun/dayjs@v1.10.2...v1.10.3) (2021-01-09)

### Bug Fixes

* fix customParseFormat plugin strict mode parse meridiem bug ([#1321](iamkun/dayjs#1321)) ([e49eeef](iamkun/dayjs@e49eeef))
* fix weekYear plugin missing locale bug ([#1319](iamkun/dayjs#1319)) ([344bdc0](iamkun/dayjs@344bdc0)), closes [#1304](iamkun/dayjs#1304)
* update advancedFormat plugin to add format options for iso week and weekyear ([#1309](iamkun/dayjs#1309)) ([2c54c64](iamkun/dayjs@2c54c64))
* update devHelper to add dev warning setting locale before loading ([c5cc893](iamkun/dayjs@c5cc893))
* update German [de] locale yearStart ([1858df8](iamkun/dayjs@1858df8)), closes [#1264](iamkun/dayjs#1264)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️Bug Something isn't working released
Projects
None yet
4 participants