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

Hours shift when creating TZDate on a DST transition date #13

Open
johnny-T opened this issue Sep 24, 2024 · 1 comment
Open

Hours shift when creating TZDate on a DST transition date #13

johnny-T opened this issue Sep 24, 2024 · 1 comment

Comments

@johnny-T
Copy link

Hello, I found out this strange behaviour when creating TZDate on the day of DST transition in Prague - that is on 27.10.2024, from GMT+2 to GMT+1. The target zone is always Europe/Prague, but when I am in a Pacific time zone, there is a certain bug.

// the following examples are in Pacific Time local timezone 

// this results in "Sun Oct 27 2024 01:00:00 GMT+0200" instead of "00:00:00" and it seems shifted because the day actually has 25 hours
new TZDate(2024, 9, 27, 0, 'Europe/Prague').toString()

// in other dates, the result is fine, in this case "Sat Oct 26 2024 00:00:00 GMT+0200"
new TZDate(2024, 9, 26, 0, 'Europe/Prague').toString()

// now the following example is in Europe/Prague local timezone

// this correctly returns "Sun Oct 27 2024 00:00:00 GMT+0200"
new TZDate(2024, 9, 27, 0, 'Europe/Prague').toString()

In order to get 00:00:00 from the Pacific Time local timezone, I have to use hour index of -1, which shouldn't be the case I believe.

@johnny-T
Copy link
Author

This seems to be fixed in version 1.1.1 thanks to the related issue #11 , I was actually testing on 1.0.2 and did not realize it has been fixed, so this issue can probably be closed :).

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