What Is Local Mean Time?
由于电脑时区使用 Time Zone Database,所以本地时间会在 1900 年左右发生时区跳变,而 JavaScript 的 Date 默认遵循当前系统时区,它的构造函数要么接受一个 UTC 时间戳,要么接受本地时间(字符串或年月日时分秒)
![]()
如果直接使用本地时间会发生以下问题:
![]()
![]()
https://www.timeanddate.com/time/zone/hong-kong/hong-kong?1900
![]()
![]()
https://www.timeanddate.com/time/zone/china/shanghai?1900
或者
![]()
毕竟上海也是有用过夏令时的
![]()
解决方法(?),求时间间隔最好还是使用标准时间。
![]()
或者
![]()
图中为 mdn 中文页面,表示毫秒的 ss 为两位,实际上毫秒应为三位
![]()
https://tc39.es/ecma262/multipage/numbers-and-dates.html#sec-date-time-string-format