gettimezoneoffset is wrong - shows -0600 when it should be +1000
Going to http://www.localeplanet.com/support/browser.html shows:
*****
navigator.browserLanguage: undefined
navigator.language: en-GB
navigator.userAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0
date: Wed Dec 25 2019 10:19:57 GMT+1000 (Australian Eastern Standard Time)
date.toLocaleDateString(): 25/12/2019
date.toLocaleTimeString(): 10:19:57
date.toLocaleString(): 25/12/2019, 10:19:57
date.toUTCString(): Wed, 25 Dec 2019 00:19:57 GMT
date.getTimezoneOffset(): -600
*****
This produces errors in some web pages.
Змінено
Усі відповіді (2)
I think that is correct.
My time zone offset is 480, or 8 hours x 60 minutes behind GMT.
Your -600 represents 10 hours x 60 minutes ahead of GMT.
Merry Christmas!
Ref. https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset
Змінено
- (new Date()).toLocaleString("en-AU",{"timeZoneName":"short"});