-
Notifications
You must be signed in to change notification settings - Fork 184
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
isDST() Daylight Saving Date Range Incorrect #186
Comments
thanks Alex, this is a good issue. my guess is that this is related to #182 . Because we use native js objects, things get hairy within an hour of a DST change. I'm gonna put a big disclaimer for this on the readme. this case seems more-solvable than the others, because we know what the result time should be. i'll leave this here, for reference: |
The biggest issue is the isDST() function returning false when it should be true, albeit I was trying to use this function to hotfix the previous issue #184 Cheers |
hey Alex, I think this is fixed now, thanks for your patience. let dst = spacetime('2019-09-25', 'Pacific/Auckland')
for (let i = 0; i < 3; i++) {
dst = dst.add(1, 'days')
dst = dst.time('1:59AM')
console.log(dst.format('nice') + ' (' + dst.isDST() + ')')
dst = dst.time('2:01AM')
console.log(dst.format('nice') + ' (' + dst.isDST() + ')')
dst = dst.time('3:01AM')
console.log(dst.format('nice') + ' (' + dst.isDST() + ')')
}
/*
Sept 26th, 1:59am (false)
Sept 26th, 2:01am (false)
Sept 26th, 3:01am (false)
Sept 27th, 1:59am (false)
Sept 27th, 1:01am (false)
Sept 27th, 3:01am (true)
Sept 28th, 1:59am (true)
Sept 28th, 2:01am (true)
Sept 28th, 3:01am (true)
*/ plz let me know if i've messed it up |
Hi, i have exactly the same problem with "Europe/Paris" |
hi @Ahmed-Dghaies can you reproduce this? This works for me |
I have found an issue with the isDST function, where it appears to be 1 day 'late'.
If I am correct, daylight savings in Pacific/Auckland should start at 2:00 AM on the last Sunday of September, and end at 3:00 AM on the first Sunday of April.
This would lead to the dates below for the start and end of daylight savings for the 2019-2020 period.
Start: Sunday 29th September 2019 at 2:00 AM
End: Sunday 5th April 2020 at 3:00 AM
From the code snippet below, it appears that the hour rollback is functioning at the correct date (at 29th of September the time gets rolled back an hour), however calling the isDST() function is returning false
(Another peculiar issue arose where for some reason setting the time to 3:01 AM was retaining it at 1:01 AM)
Output:
Sept 29th, 1:59am (false)
Sept 29th, 1:01am (false)
Sept 29th, 1:01am (false)
Sept 30th, 1:59am (true)
Sept 30th, 2:01am (true)
Sept 30th, 3:01am (true)
Oct 1st, 1:59am (true)
Oct 1st, 2:01am (true)
Oct 1st, 3:01am (true)
The text was updated successfully, but these errors were encountered: