DateJS parsing mystery
Posted
by Herb Caudill
on Stack Overflow
See other posts from Stack Overflow
or by Herb Caudill
Published on 2010-03-12T16:55:17Z
Indexed on
2010/03/12
16:57 UTC
Read the original article
Hit count: 398
I'm using DateJS to parse user-inputted dates, and getting some strange results.
Date.parse("15 Jan 2010")
returnsFri Jan 15 00:00:00 EST 2010
(right)Date.parse("15-Apr-2010")
returnsThu Apr 15 00:00:00 EDT 2010
(right)Date.parse("15 Apr 2010")
returnsThu Apr 1 00:00:00 EDT 2010
(wrong)
As far as I can tell, the d MMM yyyy
input format works fine for every month except April and August; in those two cases, it returns the first of the month no matter what day is entered. Is this a bug, or is there a logical explanation I'm missing?
© Stack Overflow or respective owner