Closed Bug 1860425 Opened 1 years ago Closed 1 years ago

Consider dropping support for numeric time zones without "GMT" prefix in Date.parse

Categories

(Core :: JavaScript: Standard Library, defect, P2)

defect

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: vinny.diehl, Assigned: vinny.diehl)

References

(Blocks 1 open bug)

Details

(Keywords: parity-chrome, parity-safari)

Attachments

(1 file)

We currently support time zone formats such as "-04" as opposed to "GMT-04", which are rejected by both Chrome and Safari:

> eshost -te 'new Date("12-Mar-2022 -04")'
Engine Result
JavaScriptCore Invalid Date
SpiderMonkey Fri Mar 11 2022 21:00:00 GMT-0700 (Mountain Standard Time)
V8 Invalid Date

While these formats are reasonable to support, we might consider dropping support for webcompat purposes.

Before I or someone else begins work on this, do you agree with this change, :arai?

Severity: -- → S3
Flags: needinfo?(arai.unmht)

Looks like this is specific to when the input has no "time" part.
If hh:mm part is provided, JavaScriptCore and V8 accept them.
Firefox accepts them except for +04 without space.
If there's only hh, no browser accepts.

JavaScriptCore SpiderMonkey V8
"12-Mar-2022 00:00:00-04" OK OK OK
"12-Mar-2022 00:00:00 -04" OK OK OK
"12-Mar-2022 00:00:00+04" OK ERR OK
"12-Mar-2022 00:00:00 +04" OK OK OK
"12-Mar-2022 00:00-04" OK OK OK
"12-Mar-2022 00:00 -04" OK OK OK
"12-Mar-2022 00:00+04" OK ERR OK
"12-Mar-2022 00:00 +04" OK OK OK
"12-Mar-2022 00-04" ERR ERR ERR
"12-Mar-2022 00 -04" ERR ERR ERR
"12-Mar-2022 00+04" ERR ERR ERR
"12-Mar-2022 00 +04" ERR ERR ERR

So, I agree with rejecting the "12-Mar-2022 -04" format, but it's better keep accepting when hh:mm are give.
and also optionally align with other browser for +04 without space.

Flags: needinfo?(arai.unmht)
Assignee: nobody → vinny.diehl
Status: NEW → ASSIGNED
Blocks: 1274354
Attachment #9359753 - Attachment description: Bug 1860425 - Adjust parsing for timezone numbers without "GMT" prefix r?arai → WIP: Bug 1860425 - Adjust parsing for timezone numbers without "GMT" prefix r?arai
Priority: -- → P2
Attachment #9359753 - Attachment description: WIP: Bug 1860425 - Adjust parsing for timezone numbers without "GMT" prefix r?arai → Bug 1860425 - Adjust parsing for timezone numbers without "GMT" prefix r?arai
Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/46326a19988d Adjust parsing for timezone numbers without "GMT" prefix r=arai
Status: ASSIGNED → RESOLVED
Closed: 1 years ago
Resolution: --- → FIXED
Target Milestone: --- → 121 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: