Funkcionalnosć toś togo sedła se pśez wótwardowańske źěła wobgranicujo, kótarež maju wašo dožywjenje pólěpšyś. Jolic nastawk waš problem njerozwězujo a cośo pšašanje stajiś, wobrośćo se na našo zgromoźeństwo pomocy, kótarež na to caka, wam na @FirefoxSupport na Twitter a /r/firefox na Reddit pomagaś.

Pomoc pśepytaś

Glědajśo se wobšudy pomocy. Njenapominajomy was nigda, telefonowy numer zawołaś, SMS pósłaś abo wósobinske informacije pśeraźiś. Pšosym dajśo suspektnu aktiwitu z pomocu nastajenja „Znjewužywanje k wěsći daś“ k wěsći.

Dalšne informacije

new Date().getTimezoneOffset() returns wrong time zone offset against Firefox ESR 52

  • 9 wótegrona
  • 7 ma toś ten problem
  • 1 naglěd
  • Slědne wótegrono wót Sunny12345

more options

I tried to use "new Date().getTimezoneOffset()" in a javascript to return the timezone offset between the time zone on my PC and UTC time.

The time zone on my PC is UTC+8,

Javascript as below, referring to https://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript

var offset = new Date().getTimezoneOffset(); console.log(offset);

It returns -60 mins. This is wrong.

Could you please advise the cause and resolution if there is?

Regards,

Sunny

I tried to use "new Date().getTimezoneOffset()" in a javascript to return the timezone offset between the time zone on my PC and UTC time. The time zone on my PC is UTC+8, Javascript as below, referring to https://stackoverflow.com/questions/1091372/getting-the-clients-timezone-in-javascript var offset = new Date().getTimezoneOffset(); console.log(offset); It returns -60 mins. This is wrong. Could you please advise the cause and resolution if there is? Regards, Sunny

Wšykne wótegrona (9)

more options

Additional info. I've tried: reinstall and ESR 45.x and change time zone several times. getTimezoneOffset() always returns -60mins.

more options

What does this code give?

  • new Date().toString();
more options

I'm in Pacific Time. Firefox 54 returns 420, which I believe means 7 hours. Since we are at -7 hours (year-round offset of -8 hours adjusted for DST), I'm not sure why 420 is a positive number.

Is your Firefox "sandboxed" in any way, such that it may not be directly reading the time from Windows 7?

more options

Thanks for the reply.

new. Date().toString() returns a result indicates the wrong time zone GMT+1, as below, "Thu Aug 03 2017 02:39:03 GMT+0100"

more options

Thanks and please fine below answer.

jscher2000 said

I'm in Pacific Time. Firefox 54 returns 420, which I believe means 7 hours. Since we are at -7 hours (year-round offset of -8 hours adjusted for DST), I'm not sure why 420 is a positive number. =>what is the time zone setting on your PC? UTC-7? Is your Firefox "sandboxed" in any way, such that it may not be directly reading the time from Windows 7? I reinstalled Firefox ESR many times and the issue persists, i did not change the browser settings. How can i know if the firefox is sandboxed or not?
more options

Please note that the browser in question is Firefox ESR.

Firefox non ESR has no such issue.

If you install the latest Firefox, you can easily reproduce the issue i believe.

Thanks.

more options

Sunny12345 said

Thanks and please fine below answer. jscher2000 said
I'm in Pacific Time. Firefox 54 returns 420, which I believe means 7 hours. Since we are at -7 hours (year-round offset of -8 hours adjusted for DST), I'm not sure why 420 is a positive number.

=>what is the time zone setting on your PC? UTC-7?

Time Zone is -8, with automatic adjustment for Daylight Savings Time. (Screenshot attached.)

Is your Firefox "sandboxed" in any way, such that it may not be directly reading the time from Windows 7?

I reinstalled Firefox ESR many times and the issue persists, i did not change the browser settings.

How can i know if the firefox is sandboxed or not?

I don't use ESR, sorry. Firefox could be sandboxed by security software or by a virtual machine program (e.g., VirtualBox). Probably you would notice other symptoms such as limitations on Firefox's ability to work with the hard drive or interact with other programs.

more options

This looks like UK time.

What Firefox locale do you have (about:config -> general.useragent.locale)?

more options

Thank you! the locale is set to locale. please refer to the attachment.