Closed Bug 1676708 Opened 6 months ago Closed 3 months ago

Invalid date parsing with GMT starting with 00

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox87 --- fixed

People

(Reporter: calixte, Assigned: calixte)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

For example in Firefox nightly 84:

>> new Date("Wed Nov 11 2020 19:18:50 GMT+0010 (Central European Standard Time)").toUTCString()
-> "Wed, 11 Nov 2020 09:18:50 GMT"

when it should be "Wed, 11 Nov 2020 19:08:50 GMT"

We probably need to check partLength too here:
https://searchfox.org/mozilla-central/source/js/src/jsdate.cpp#1187

Assignee: nobody → cdenizet
Status: NEW → ASSIGNED
Blocks: 1274354

The MDN documentation specifies that 00xx stands for 0 hours and xx minutes.
So that patch adds a check with the length of the offset to be sure that minutes won't become hours.

Severity: -- → S4
Priority: -- → P1

Calixte, would you have time to move the test case to a different file, as suggested in https://phabricator.services.mozilla.com/D96755#3166362 ?

Flags: needinfo?(cdenizet)

I just moved the test in parse-time-zone.js file.

Flags: needinfo?(cdenizet)
Pushed by cdenizet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/29161b592e83
Parse a date with GMT+00xx leads to an incorrect timezone offset r=jorendorff
Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.