be more strict with Date.parse('YYYY-MM-D'), don't treat it as ISO 8601 and don't generate a UTC Date
Categories
(Core :: JavaScript Engine, task, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox121 | --- | fixed |
People
(Reporter: aryx, Assigned: vinny.diehl)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-needed, parity-chrome)
Attachments
(1 file)
Date.parse('2022-08-08') - Date.parse('2022-08-8')
returns 0
in Firefox but the timezone offset it milliseconds in Chrome.
Firefox should only regard YYYY-MM-DD
as valid ISO 8601 input which gets assumed as UTC.
Comment 1•2 years ago
|
||
Ok, to refine the bug content, the problem is that:
In Firefox:
> Date.parse("2022-08-8") - Date.parse("2022-08-08 00:00:00+0000")
0
> Date.parse("2022-08-08") - Date.parse("2022-08-08 00:00:00+0000")
0
> Date.parse("2022-08-08 00:00:00") - Date.parse("2022-08-08 00:00:00+0000")
-7200000
Whereas Chromium has the following output:
> Date.parse("2022-08-8") - Date.parse("2022-08-08 00:00:00+0000")
-7200000
> Date.parse("2022-08-08") - Date.parse("2022-08-08 00:00:00+0000")
0
> Date.parse("2022-08-08 00:00:00") - Date.parse("2022-08-08 00:00:00+0000")
-7200000
From my point of view, 2022-08-8
, 2022-08-08
and 2022-08-08 00:00:00
should all have the same output, as no offset is defined, they should all have the same inferred timezone offset.
Comment 2•2 years ago
|
||
Date.parse("2022-08-08 00:00:00") - Date.parse("2022-08-08 00:00:00+0000")
FYI: In FF the last one reveals your current timezone offset. For example with RFP enabled, it returns 0. So -720000 is 10 hrs or -1200, which makes August 8th 2022, one of these (assuming my math is correct, and you have enabled DST on your system):
America/Anchorage, America/Juneau, America/Metlakatla, America/Nome, America/Sitka, America/Yakutat, Etc/GMT+8, Pacific/Pitcairn
[1] https://arkenfox.github.io/TZP/tests/timezones.html > type 2022 into field and hit [combine years]
- I cheated and modified the code just for August 8th 2022
Updated•2 years ago
|
Assignee | ||
Updated•6 months ago
|
Assignee | ||
Comment 3•6 months ago
|
||
Updated•6 months ago
|
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/fb640e018d72 Don't parse single digit mon or mday as an ISO date r=arai
Comment 5•6 months ago
|
||
bugherder |
Assignee | ||
Comment 6•5 months ago
|
||
Relnoted here: https://github.com/mdn/content/pull/30234
Assignee | ||
Updated•5 months ago
|
Description
•