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

gggg not working correctly #1304

Closed
maxsimych opened this issue Jan 3, 2021 · 5 comments · Fixed by #1319 or backstage/backstage#4967
Closed

gggg not working correctly #1304

maxsimych opened this issue Jan 3, 2021 · 5 comments · Fixed by #1319 or backstage/backstage#4967
Labels
☢️Bug Something isn't working released

Comments

@maxsimych
Copy link

Describe the bug
gggg not returns week year, but just a year
The same functionality in moment js works correctly

const dayjs = require('dayjs');
const moment = require('moment')
const weekOfYear = require('dayjs/plugin/weekOfYear');
const weekYear = require('dayjs/plugin/weekYear');
const advancedFormat = require('dayjs/plugin/advancedFormat');
require('dayjs/locale/en-gb')
dayjs.locale('en-gb')

dayjs.extend(weekYear)
dayjs.extend(weekOfYear)
dayjs.extend(advancedFormat)
console.log(dayjs().toString())
console.log(dayjs().format('gggg-ww'))
console.log(moment().locale('en-gb').format('gggg-ww'))

Expected behavior
Sun, 03 Jan 2021 20:38:27 GMT
2020-53
2020-53

Result
Sun, 03 Jan 2021 20:38:27 GMT
2021-53
2020-53

Information

  • Day.js Version 1.10.1
  • OS: linux
  • Browser chrome 87
  • Time zone: UTC+3 (Europe/Moscow)
@iamkun
Copy link
Owner

iamkun commented Jan 4, 2021

-

@iamkun iamkun closed this as completed Jan 4, 2021
@iamkun iamkun reopened this Jan 4, 2021
@iamkun
Copy link
Owner

iamkun commented Jan 4, 2021

Sorry for the wrong reply above.

gggg should return the Week Year in Day.js the same as moment.js.

I've tested ok on my side, https://runkit.com/embed/9x7snt5xa0ts

image

@maxsimych
Copy link
Author

maxsimych commented Jan 6, 2021

It's ok in your case, because the issue appears only 1-3rd of January.

Here we can see wrong result for 2nd of January

https://runkit.com/maxsimych/5ff5547c4ec2200013f4d252

image

@iamkun
Copy link
Owner

iamkun commented Jan 6, 2021

bug confirmed.

@iamkun iamkun added the ☢️Bug Something isn't working label Jan 6, 2021
iamkun added a commit that referenced this issue Jan 6, 2021
iamkun added a commit that referenced this issue Jan 6, 2021
* fix: fix weekYear plugin missing locale bug

fix #1304
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
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
2 participants