Firefox和Chrome返回到ISOstring()的日期的返回值不同

问题描述 投票:0回答:1

Chrome和Firefox中日期对象的ISO字符串表示形式似乎有所不同。如果在Chrome和Firefox中运行以下示例代码,则会获得不同的结果:

new Date(  "1-Nov-2010 00:00 UTC").toISOString();

Firefox:-002010-11-01T00:00:00.000Z

Chrome:2010-11-01T00:00:00.000Z

-00是什么,为什么Firefox的行为与Chrome不同?

javascript google-chrome firefox iso
1个回答
1
投票

这只是非标准的日期格式。 Firefox正在解析它,并看到“哦,您想要年份-2010”,Chrome似乎对其进行了更好的解析,但我只是建议不要在日期中使用该特定的字符串格式。

© www.soinside.com 2019 - 2024. All rights reserved.