javascript - Date.prototype.setMonth() changes the timezone offset? -


this occurs setmonth() method , none of other set*() methods.

here's example of mean:

var date = new date(); date.gettimezoneoffset(); // -60  date.setmonth(5); date.gettimezoneoffset(); // -120 

is expected behavior? there's nothing mentioned on mdn.

edit:

wow i'm idiot.

the gettimezoneoffset method returns different value during dst, , in month 5 dst different now.

the time zone offset returned 1 applies date it's called on. host system configured daylight saving, offset change depending on date , time date represents , daylight saving applies.

var date = new date();  console.log(date.gettimezoneoffset());    date.setmonth(0);  console.log(date.gettimezoneoffset());    date.setmonth(5);  console.log(date.gettimezoneoffset());

btw, if run code during june - see there no difference :)


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -