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

5 minute discrepancy between actual- and displayed UTC offset for moments before "1940-05-15T23:40:00Z" in CET/CEST #5534

Open
cueedee opened this issue Oct 15, 2019 · 5 comments

Comments

@cueedee
Copy link

cueedee commented Oct 15, 2019

moment.version

'2.24.0'

My system's timezone is CET/CEST which explains the +02:00 UTC offset of:

moment( "1940-05-15T23:40:00Z" ).format( "HH:mm Z" )

'01:40 +02:00'

According to https://www.timeanddate.com/time/change/netherlands/amsterdam?year=1940, on Thursday, 16 May, 00:00 1940 (local time), the UTC offset in that timezone was changed by +01:40, which afaict should mean that moments before 1940-05-15T23:40:00Z, like for instance 1940-05-15T23:39:59Z should display a +00:20 offset.... however:

moment( "1940-05-15T23:39:59Z" ).format( "HH:mm Z" )

'23:59 +00:15'

Would have me to believe that the UTC offset now is +00:15, yet the 23:59 time demonstrates the +00:20 offset that was expected... (23:59 - 00:20 = 23:39 - the UTC time of the argument to moment(...) above)

The above has been observed regardless of Javascript environment tried: NodeJS 10.16.3, Chrome 77.0.3865.120 and FireFox 69.0.3.

@cueedee cueedee changed the title Moment.format() changes UTC offset for inputs < "1940-05-15T23:40:00Z" 5 minute discrepancy between actual- and displayed UTC offset for moments before "1940-05-15T23:40:00Z" in CET/CEST Nov 1, 2019
@ederius
Copy link

ederius commented Apr 17, 2020

I have a related issue, any idea about it?

@cueedee
Copy link
Author

cueedee commented Apr 22, 2020

@ederius, as can be learned from this issue's creation date it has not managed to attract a great deal of attention since its inception... I have no idea how to proceed.

@ederius
Copy link

ederius commented Apr 24, 2020

My issue is easy to reproduce, try with this: moment("1910-12-31").toISOString() the result of that should be 1910-12-31T05:00:00.000Z if your timezone is -05:00, But is 1910-12-31T04:56:16.000Z, subtract 3 minutes. Have you any idea why do that @cueedee?

@cueedee
Copy link
Author

cueedee commented Apr 28, 2020

@ederius, sorry no, I haven't got a clue. Like you, I'm hoping the good people at Moment.js will be able to explain... If only they could be enticed to have a look...

That being said...

Maybe this will help to provide some insight:

https://www.timeanddate.com/time/map/

Select the city that refers to your timezone, then on the resulting page, select the "Time Zone" menu item, and then in the "Time zone changes for:" dropdown, select the range that includes the year of your interest. Does that list information about any UTC offset changes in that period?

Does it match what you experience in Moment.js, or mismatch?

@marwahaha
Copy link
Member

Does this happen on the native Date() object too?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants