-
-
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 plugin unexpected daylight calculation #1001
Comments
What's the status on this? |
I have run in to the same issue. Here is my test case, which is a bit simpler than the one above: Expected:
Actual:
And some information dayjs: 1.8.35 Edit: I just noticed DST actually started in the early hours of March 8, so it appears dayjs may be incorrectly calculating when DST should start (March 9 should have already been using -4 offset, but instead dayjs.tz() didn't start using -4 offset until March 10) |
Timezone support seems to be quite broken at the moment, unfortunately. dayjs.tz("11-20-2020", "America/Los_Angeles").format()
// '2020-11-20T00:00:00-08:00'
dayjs.tz("11-20-2020", "America/Los_Angeles").toISOString()
// '2020-11-20T09:00:00.000Z' <--- 09:00:00 is incorrect here, should be 08:00:00 Compare to moment.tz('11-20-2020', 'MM-DD-YYYY', 'America/Los_Angeles').toISOString()
// '2020-11-20T08:00:00.000Z' |
I am also experiencing problems that I think might be related to this issue. var moment = require("moment-timezone");
var dayjs = require("dayjs");
var utc = require("dayjs/plugin/utc");
var timezone = require("dayjs/plugin/timezone");
dayjs.extend(utc);
dayjs.extend(timezone);
var dateDay = dayjs.tz("2016-03-27 02:00:00", "Europe/Athens");
var dateMoment = moment.tz("2016-03-27 02:00:00", "Europe/Athens");
console.log("DayJs: ", dateDay.format());
console.log("MomentJs: ", dateMoment.format());
//Output:
//DayJs: 2016-03-27T03:00:00+02:00
//MomentJs: 2016-03-27T02:00:00+02:00 Notice the difference in the hours. |
I've the same problem. Any progress on this ticket?
|
Made a test with another lib, could be helpful. |
@alex-w0 The bug fix was merged. Can you try with the latest changes and see if the bug exists? |
@addisonElliott I've tested my use case and it seems to work. @JeppeLarsen @nfantone Can you test your example as well? |
The problem is still relevant. |
Still relevant for us as well. |
And for us. Was planning to replace moment with dayjs but I have the same issue. Generate a UTC date, set the hour to 10:00, and when formatting to ISO string getting 11:00 instead. Anything not UTC works well and returns 10:00. |
Describe the bug
When using the timezone plugin the date calculated by
dayjs
is unexpected fordaylight datetime
calculation, I'm comparing towards moment-timezone.Expected behaviour
Information
The text was updated successfully, but these errors were encountered: