为什么Safari在悉尼,澳大利亚时区的DST开始时对Date.getDay()感到困惑? [英] Why is Safari confused about Date.getDay() for DST start in Sydney, Aus time zone?

查看:135
本文介绍了为什么Safari在悉尼,澳大利亚时区的DST开始时对Date.getDay()感到困惑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OSX上的Safari认为2013年10月6日是澳大利亚的一个星期六。它不是,它实际上是星期天。

Safari on OSX believes that October 6th, 2013 is a Saturday in Australia. It's not, it's actually a Sunday.

要复制此问题,只需将时区设置为悉尼 - 澳大利亚,在Safari中弹出开启控制台,然后输入新日期( 2013年10月6日)。你会得到这个:

To replicate this issue, just set your time zone to Sydney-Australia, pop open the dev console in Safari, and enter new Date("2013/10/06"). You'll get this:

现在改为西雅图 - 美国,你会得到这个:

Now change to Seattle-US and you'll get this:

墨尔本 - 澳大利亚也出现问题,但不是更远的北方城市,如布里斯班(适合澳大利亚DST区划)或其他一些城市我在世界各地测试过的城市。

The problem also occurs for Melbourne-Australia but not for cities further north such as Brisbane (which fits the zoning for Australian DST), or a handful of other cities I've tested throughout the world.

现在,它恰好发生在2013年10月6日的在悉尼开始夏令时。。并且其他年份的其他DST开始日期也犯了同样的错误。 DST结束日期似乎没有问题。 PDT时区的DST开始日期似乎没有问题。此外,Chrome和Firefox不会出现此问题。

Now, it just so happens that October 6th, 2013 is the start of daylight savings time in Sydney.. And the same mistake is made for the other DST start dates in other years. There does not seem to be a problem for DST end dates. There does not seem to be a problem for DST start dates in PDT time zone. Also, Chrome and Firefox do not exhibit this problem.

我在两台不同的Mac上测试了大部分内容,其中一台在Snow Leopard上使用Safari 5.1.7,另一台在Lion 6.0 with Safari 6.0.2。

I've tested most of this on two different Macs, one on Snow Leopard with Safari 5.1.7 and one on Lion with Safari 6.0.2.

所以问题是 - 这是一个错误还是有某种理性的原因?

推荐答案

这真的应该被视为一个错误 - 从技术上讲,悉尼的DST始于2013年10月6日凌晨2点,所以凌晨2点然后变成凌晨3点( http://www.timeanddate.com/worldclock/clockchange.html?n=240 )。在这种情况下,Safari似乎认为你的意思是2013/10/06午夜 - 然后在前一天的1小时到晚上11点。这甚至没有意义,因为在凌晨2点,时钟应该向前推进一小时。

This really should be considered a bug - Technically speaking DST in Sydney starts on 2013/10/06 at 2AM, so 2AM then becomes 3AM (http://www.timeanddate.com/worldclock/clockchange.html?n=240). It appears Safari in this case is thinking you mean 2013/10/06 at midnight - and is then going back 1 hour to 11PM the previous day. This doesn't even make sense because at 2AM the clock is supposed to go forward an hour.

我建议为此提交错误报告 - 因为输出是如此显然是错误的

I would recommend filing a bug report for this - because the output is so obviously wrong

https://developer.apple.com/bugreporter/

这篇关于为什么Safari在悉尼,澳大利亚时区的DST开始时对Date.getDay()感到困惑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆