0

I'm using Google Chrome v80.0.3987.149 on Windows 10 x64 1909. When I using getTimezoneOffset() function in JS, the results is very strange:

new Date(60960000).getTimezoneOffset() === -480

but

new Date().getTimezoneOffset() === -420

Screen shot

I tested with Firefox, Edge Chromium and the results are same as Chrome. With IE11 and Old Edge, the results are -420 with both command (it's correct). I checked time setting in windows, it's GMT+7 (correctly). On 2 my other computers with same Windows 10 and Chrome, there are 1 computer display same as main computer (wrong) and 1 computer display correctly.

I don't know why that, please help me. Thank you.

zxcde
  • 3
  • 3
  • 1
    The first relates to a date (2 Jan 1970) with daylight saving according to your system settings, the other without daylight saving (around 31 Mar 2020). – RobG Mar 31 '20 at 04:50
  • @RobG thanks for your support, I'm reading about daylight saving but please explain for me why 1 others computer with same Chrome and Windows 10 1909 x64 is display correctly ? – zxcde Mar 31 '20 at 04:59
  • 1
    Earlier implementations of ECMAScript were required to apply current offset rules as if they'd always existed. More recent versions are required to observe historic changes in offset (e.g. try the offset in a date for say 1850). The difference can be explained as the extent to which various implementations support newer versions of ECMA-262 (the ECMAScript language specification). See [*Browsers, time zones, Chrome 67 Error (historic timezone changes)*](https://stackoverflow.com/questions/50609860/browsers-time-zones-chrome-67-error-historic-timezone-changes), of which this is probably a dupe. – RobG Mar 31 '20 at 09:19

0 Answers0