Closed Bug 1275498 Opened 8 years ago Closed 7 months ago

Date.parse('1-1-2012') returns NaN in Firefox but 1325404800000 in Chrome, Edge, and IE11

Categories

(Core :: JavaScript: Standard Library, defect)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1557650
Tracking Status
firefox46 --- affected
firefox47 --- affected
firefox48 --- affected
firefox49 --- affected
firefox-esr38 --- affected
firefox-esr45 --- affected

People

(Reporter: cpeterson, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: parity-chrome, parity-edge, parity-ie)

http://dygraphs.com/date-formats.html reports a number of Date.parse() problems, but the Firefox problems mostly stem from the parsing of dates with dash delimiters:

GOOD: Date.parse('1/1/2012') returns 1325404800000 Chrome, Edge, IE11, Firefox, and Safari.

BAD: Date.parse('1-1-2012') returns 1325404800000 in Chrome, Edge, and IE11 but NaN in Firefox and Safari.
Component: JavaScript Engine → JavaScript: Standard Library
I've been lurking around some of theses Date.parse bugs/feature requests and decided to start working on them.

As far as I can see we previously supported the '1-1-2012' format (there is even commented out code for this) but
seems to have decided to support dates with the format 'Wed Nov 05 21:49:11 GMT-0800 1997', where the tz offset comes
before the year, instead.

A very simple solution is to just remove the out-commented check on line 1020 at the expense of the format where the year comes last. I'm looking into how much work it is to get support for both formats.
Assignee: nobody → eric
Mass bug change to replace various 'parity' whiteboard flags with the new canonical keywords. (See bug 1443764 comment 13.)
Whiteboard: [parity-chrome][parity-edge][parity-ie]
Assignee: eric → nobody
Severity: normal → S3

I'm adding support for this in bug 1557650. :)

Status: NEW → RESOLVED
Closed: 7 months ago
Duplicate of bug: 1557650
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.