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

Filed under:
|
|
|

I'm using DateJS to parse user-inputted dates, and getting some strange results.

  1. Date.parse("15 Jan 2010") returns Fri Jan 15 00:00:00 EST 2010 (right)

  2. Date.parse("15-Apr-2010") returns Thu Apr 15 00:00:00 EDT 2010 (right)

  3. Date.parse("15 Apr 2010") returns Thu 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

Related posts about datejs

Related posts about jQuery