-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Timezone 'Europe/London' is not working properly #2126
Comments
tested it with pr #2118 and the result was what was expected - '2022-01-01' |
We just faced this bug while working with multiple timezones. Is there a workaround for this while we wait for the PR to get merged? |
We discovered this issue during development. Here is a simple test that demonstrates the problem. it("should NOT fail", () => {
const date1 = dayjs.tz("2020-01-25", "Europe/London").startOf("day");
const date2 = dayjs.tz("2020-01-25", "Europe/London").startOf("day");
expect(date1.isSame(date2)).toBe(true);
expect(date1.isSame(date2, "day")).toBe(true);
}); Luckily in our case we could work around this issue by not applying it("this works", () => {
const date1 = dayjs.tz("2020-01-25", "Europe/London");
const date2 = dayjs.tz("2020-01-25", "Europe/London");
expect(date1.isSame(date2, "day")).toBe(true);
}); @obviyus maybe this is also a viable workaround for you? |
@AplusKminus our situation is slightly different where I wish to have the time at the start of the day. We ended up moving to using https://github.com/js-joda/js-joda instead. |
Hi team,
I have used (dayjs().tz('Europe/London').startOf('year').format('YYYY-MM-DD')) method in my project. This method is not working properly with this tz. The output should be (2022-01-01) but I received (2021-01-01).
Can anyone suggest the solution? and Why this issue was occurred?. Thanks in advance
Note: Other timezones are working fine and same method working fine in codesandbox.
The text was updated successfully, but these errors were encountered: