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

NEW
Assigned to

Status

()

Core
JavaScript: Standard Library
2 years ago
6 months ago

People

(Reporter: cpeterson, Assigned: tephra)

Tracking

(Blocks: 1 bug)

unspecified
Points:
---

Firefox Tracking Flags

(firefox46 affected, firefox47 affected, firefox48 affected, firefox49 affected, firefox-esr38 affected, firefox-esr45 affected)

Details

(Whiteboard: [parity-chrome][parity-edge][parity-ie])

(Reporter)

Description

2 years ago
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
Duplicate of this bug: 1341481
(Assignee)

Comment 2

6 months ago
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)

Updated

6 months ago
Assignee: nobody → eric
You need to log in before you can comment on or make changes to this bug.