JavaScript在Microsoft的Edge浏览器中对Africa/Cairo时区返回不正确的值。

huangapple go评论81阅读模式
英文:

JavaScript toLocaleString returning incorrect value for Africa/Cairo time zone on Microsoft's Edge

问题

自从埃及重新引入夏令时已经过去了一周多,但在Edge上执行以下JS语句仍然返回不正确的值。(Chrome从未出现过这个问题。)

new Date(new Date().toLocaleString("en-US", { timeZone: 'Africa/Cairo' }))

这个问题是否可以通过Windows中的设置来修复?

Edge与Chrome上运行的控制台截图

英文:

It's been more than a week since Egypt re-introduced DST but following JS statement still returns incorrect value on Edge. (Chrome never have the problem.)

new Date(new Date().toLocaleString("en-US", { timeZone: 'Africa/Cairo' }))

Is this something that can be fixed by a setting in Windows?

Screenshot of console runs on Edge vs Chrome

答案1

得分: 1

这是Microsoft Edge中已知的问题,"Eastern European Summer Time"在Cairo时区的Edge中无法识别。这需要进一步的调查。

当前的解决方法是将Windows时区更改为"(UTC + 02:00) Beirut"(或其他UTC + 02:00地区),因为Edge在那里正确应用Eastern European Summer Time。至于toLocaleString,您需要将'Africa/Cairo'更改为'Asia/Beirut'(或其他UTC + 02:00地区)。

更新

Microsoft已经在Microsoft Edge稳定版113.0.1774.45(尚未发布)中解决了这个问题。在Microsoft Edge Canary(已发布的版本为115.0.1846.0)中,此问题已解决。

英文:

This is a known issue in Microsoft Edge that the "Eastern European Summer Time" is not recognized in Edge for Cairo-timezone. This needs further investigation.

Current workaround is to change your Windows timezone to "(UTC + 02:00) Beirut" (or other UTC + 02:00 region), as Edge applies there Eastern European ​Summer Time correctly. As to toLocaleString, you need to change 'Africa/Cairo' into 'Asia/Beirut' (or other UTC + 02:00 region).

UPDATE

Microsoft has resolved this issue in Microsoft Edge Stable version 113.0.1774.45 (yet to release). On Microsoft Edge Canary (115.0.1846.0, has been released), this issue is resolved.

huangapple
  • 本文由 发表于 2023年5月11日 12:58:18
  • 转载请务必保留本文链接:https://go.coder-hub.com/76224259.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定