英文:
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中的设置来修复?
英文:
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?
答案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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论