Date.parse
is not documented as accepting a string in that format, so you cannot rely on it doing so.
Date.parse
(and the version of new Date
that accepts a string) are only required to support these formats of strings:
In my experience, all implementations also support the American mm/dd/yyyy
format (even in non-US locales), but that is not specified or documented behavior.
If your input string is in that format, you'll have to parse it yourself or use a library like MomentJS to do it for you.
Side note: In your code, you said that Date.parse
was giving you a Date
(or a date string; you said the alert was showing "Sat Sep 20 2014 00:00:00 GMT-0500 (Central Standard Time)" and the like). That would be fairly surprising. Date.parse
returns a number, not a Date
. To get the equivalent Date
object, use new Date
.
* About "(and slightly incorrect)": In ISO-8601, a string with no timezone indicator on it defines a time in local time. ES5, however, says those are GMT.