本文介绍了Windows 10上的镶边/边缘之间的时差的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Chrome和Edge之间,我在Windows 10上获得了TZ的区别。
当我在控制台中运行这段代码时:

 > var date = new Date(2013,2,29,1,0,0,0); 
>日期

这将是在Edge上运行时的输出

 > [日期] 2013年3月29日星期五01:00:00 GMT + 0200(耶路撒冷标准时间)

这将是Chrome上的输出:

 > [date] Fri Mar 29 2013 01:00:00 GMT + 0300(Jerusalem Daylight Time)

它似乎在Chrome中它被识别为DST,但在边缘它不,这是正确的。



我以绿色突出显示的最后一部分是DST开始日期。

  00 00 =年(忽略)
03 00 =月份(3月)
05 00 =星期几(星期五)
05 00 =天数(5 =最后)
02 00 = 02:00)
00 00 =分钟
00 00 =第二个
00 00 =毫秒

因此,Windows和IANA数据都指向同一日期。然而,不知何故,铬是错误的。





我也测试过的FireFox,它也似乎错了:





我也可以在Node.js中重现这些结果。



但是,Edge正确地得到它:





请注意,浏览器在调整落入间隙的本地时间方向上也存在差异通过春季前进过渡。这是预料之中的, 。



我并不在这些浏览器的实际实现中工作,但我的理解是Chrome,Node和FireFox都依赖于的时区内部。 Update: It appears to be a bug in the Microsoft C/C++ Runtime. I'm working on getting it to the right folks.

As far as what to do about it - if accurate historical time zone data is essential to your application, I strongly suggest you not rely on the environment to provide it, but bring it yourself using one of the libraries I listed here, such as moment-timezone (which I help maintain).

这篇关于Windows 10上的镶边/边缘之间的时差的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 16:34