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

week() with timezone is incorrect. (Europe/London) #1776

Open
jetzhliu opened this issue Jan 22, 2022 · 1 comment
Open

week() with timezone is incorrect. (Europe/London) #1776

jetzhliu opened this issue Jan 22, 2022 · 1 comment

Comments

@jetzhliu
Copy link

Describe the bug

Performance is inconsistent with momentjs.

see https://codesandbox.io/s/blue-platform-4zlug?file=/src/index.js

console.log(
  'dayjs: 2021-01-05',
  dayjs.tz('2021-01-05', 'Europe/London').format("gggg-wo"),
  dayjs.tz('2021-01-05', 'Europe/London').week()
);

// output
// dayjs: 2021-01-05 2021-6th 6

console.log(
  'moment: 2021-01-05',
  moment.tz('2021-01-05', 'Europe/London').format("gggg-wo"),
  moment.tz('2021-01-05', 'Europe/London').week()
);

// output
// moment: 2021-01-05 2021-2th 2

Expected behavior

output dayjs: 2021-01-05 2021-2th 2

Information

  • Day.js Version 1.10.7
  • OS: MacOs
  • Browser chrome 96.0.4664.93
  • Time zone: GMT+0800
@jetzhliu
Copy link
Author

the same problem here, only on utc 0.

dayjs('2022-01-23').utcOffset(0, true).format()
// print: 2022-01-23T00:00:00Z

dayjs('2022-01-23').utcOffset(0, true).add(1, 'minute').format()
// print 2022-01-22T16:01:00Z
// !!!

dayjs('2022-01-23').utcOffset(1, true).format()
// print 2022-01-23T00:00:00+01:00

dayjs('2022-01-23').utcOffset(1, true).add(1, 'minute').format()
// print 2022-01-23T00:01:00+01:00

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