jsch / datejs

Automatically exported from code.google.com/p/datejs
Other
0 stars 0 forks source link

Parsing Fails on 12:00 PM & 12:00 AM #132

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

Date.parse("1/1/2011 12:00 PM") = null 
(shouldn't it be "Sat Jan 1 12:00:00 EST 2011"?)

Date.parse("1/1/2011 12:00 AM") = Sat Jan 1 12:00:00 EST 2011 
(shouldn't it be "Sat Jan 1 00:00:00 EST 2011"?)

I'm using the latest version as of 8/26/2011 on Windows 7.

Seems like the library should handle these times with ease. Is there something 
I'm doing wrong?

Original issue reported on code.google.com by wdavid...@yahoo.com on 25 Aug 2011 at 4:15

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I just ran into this as well. I was going nuts trying to figure out what was 
wrong with my deployment because it *didn't* happen on the 
http://www.datejs.com site (in the "Mad Skillz" text box).

Here's why: The www.datejs.com site is using a newer date.js file that has 
never been released, which fixes this bug. The latest official download 
(http://datejs.googlecode.com/files/date.js) shows "13-Nov-2007" in the header 
(and Google says it was uploaded on the 19-Nov-2007, so that fits), but the 
website is using http://www.datejs.com/build/date.js, which shows the date 
"2008-05-13" in the header and has several changes from the "13-Nov-2007" 
version. Both files claim to be "1.0 Alpha-1".

I have no idea whether using the unreleased-but-used-by-the-live-site version 
is a good or bad idea, but this "12:00pm" thing is a serious bug, so it's very 
tempting...

More than three years after being changed (if we believe the header), it would 
be good to see this officially released.

Original comment by t...@crowdersoftware.com on 10 Nov 2011 at 2:49

GoogleCodeExporter commented 9 years ago
Already found one difference (not a bug, just a difference): The `addDays` 
method treats strings (rather than numbers) differently than it used to. (This 
was actually a bug in the code I'm looking at, it wasn't meant to be passing a 
string to `addDays`.) In this case, `new Date(2011, 10, 10).addDays("7")` 
results in 2012/02/15, whereas  `new Date(2011, 10, 10).addDays(7)` results in 
2011/11/17. In the official release from 13/Nov/2007, both result in 
2011/11/17. I bet this applies to the other add/subtract methods as well.

Original comment by t...@crowdersoftware.com on 10 Nov 2011 at 3:12

GoogleCodeExporter commented 9 years ago
Thanks for troublehooting this! I'll try the other file....

Original comment by wdavid...@yahoo.com on 10 Nov 2011 at 3:27

GoogleCodeExporter commented 9 years ago
works as expected in the current build onmy fork: 
https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 15 Sep 2013 at 11:20