Detecting changes to system time in JavaScript

前端 未结 7 1460
猫巷女王i
猫巷女王i 2021-01-04 04:04

How can I write a script to detect when a user changes their system time in JS?

7条回答
  •  独厮守ぢ
    2021-01-04 04:50

    Don't think there is a solution to what you are asking for but you can get the users timezone offset.

    new Date().getTimezoneOffset() * -1
    

    This returns the offset in minutes from GMT. Bare in mind though this does not take DST into consideration.

提交回复
热议问题