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
moment().startOf() fails during extra daylight savings hour #3580
Comments
There's still something up here. The last line should have stayed in GMT-0500 (Eastern Standard Time). I also get the same results using |
(Chrome 57 latest on Win10, on Moment 2.18.1) |
The same problem here - moment 2.19.2, Chrome 62 on Win10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the Issue and Steps to Reproduce:
Calling
moment().startOf('hour')
during the hour that's repeated when clocks are rolled back from daylight savings time yields the next hour, not the previous one.For example,
moment([2016,10,6]).add(1, 'hour').toDate()
correctly yieldsSun Nov 06 2016 01:00:00 GMT-0700 (PDT)
(where my local timezone is US/Pacific), whereasmoment([2016,10,6]).add(1, 'hour').startOf('hour').toDate()
yieldsSun Nov 06 2016 01:00:00 GMT-0800 (PST)
. This leads to some very odd behavior, likemoment([2016,10,6]).add(1, 'hour').startOf('hour') <= moment([2016,10,6]).add(1, 'hour')
yieldingfalse
. The same problem occurs forstartOf('minute')
andstartOf('second')
.Strangely, this does not seem to be a problem when setting the timezone explicitly using
moment.tz([2016,10,6], 'US/Pacific')
.Environment:
This is running moment version 2.15.2 directly off of the momentjs homepage in my browser's console. I'm running Safari 10.0.1 on macOS 10.12.1. I get the same problem on Firefox 49.0.2, but not on Chrome 54.0.2840.71.
If you are reporting an issue, please run the following code in the environment you are using and include the output:
The text was updated successfully, but these errors were encountered: