Why does JavaScript Date.getTimezoneOffset() consider “-05:00” as a positive offset?

后端 未结 2 1654
[愿得一人]
[愿得一人] 2020-12-08 09:25

I noticed that for us on Eastern Time zone (\"America/New_York\") with timezone offset of \"-05:00\" Date.getTimezoneOffset() returns a positive

2条回答
  •  攒了一身酷
    2020-12-08 09:51

    Because that's how it's defined. Quoting the doc (MDN):

    The time-zone offset is the difference, in minutes, between UTC and local time. Note that this means that the offset is positive if the local timezone is behind UTC and negative if it is ahead.

提交回复
热议问题