-
Notifications
You must be signed in to change notification settings - Fork 30.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
Regression on Date.getHours() on node v10.4.1 #21308
Comments
@nodejs/v8 |
Also, this is an issue with v10.4.0 as well, so it’s not the V8 timezone patch we included in v10.4.1. |
We upgraded from V8 6.6 to 6.7 and 6.7 has correcter timezone handling (it delegates it to ICU.)
Can you explain why? |
@bnoordhuis I don't really have any data to back this up, but it is the behaviour in a lot of previous node versions, I just tested v10.3.0, v9.5.0, v8.0.0 and they all output |
According to the MDN docs:
Since BST(British Summer Time) is To get the UTC hours without the timezone offset, you should use |
@AyushG3112 Yep definitely agree with you, |
@gsouquet According to what @bnoordhuis said
And V8 6.7 landed in Node.js v10.4.0, you can see the relevent PR for V8 here: #19989 This means that any release before v10.4.0 handles timezones differently than v10.4.0 and later do. |
As an extra note I'm using Node 8.11 in UTC+10 and getHours() returns one hour more than it should, toLocaleString() returns the correct time - this is from a date initiated with an ISODate string: New Date(new Date().toISOString()).getHours() - 17 The above code in Chrome returns 16. Hopefully v10.4 will fix this when I get around to upgrading! |
I have recently upgraded to node v10.4.1, we were running on v10.3.0 before but decided to upgrade due to https://nodejs.org/en/blog/vulnerability/june-2018-security-releases/
It seems like there is a regression on the
Date
object with timezone.The expected output is
0
. When running v10.3.0, the code above outputs0
.I am located in London, which means that my timezone is BST (British Summer Time). My computer date/time is correct, it is connected to Apple's NTP server (time.euro.apple.com)
Not sure what other info would be relevant for you to solve this issue. Let me know if you need anything from me.
The text was updated successfully, but these errors were encountered: