sobhagya-sahu / datejs

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

12:00 AM interpreted as noon #125

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Date.parse(6/16/2011 12:00:00 AM)
2. compare to Date.parse(6/16/2011 12:01:00 AM)
3.

What is the expected output? What do you see instead?
12:01 am should be after 12:00 am. It's not (12:00 AM is being interpreted as 
noon).

What version of the product are you using? On what operating system?
Most recent

Please provide any additional information below.

Original issue reported on code.google.com by ehrlich....@gmail.com on 16 Jun 2011 at 3:06

GoogleCodeExporter commented 8 years ago
Also, 

Date.parse("2009-12-31 12:00:00 AM").equals(new Date("2009-12-31 12:00:00 AM")) 

is false. 

Tested in 
chrome    17.0.963.83, 
ie        9.0.8112.16421, 
opera     11.61

Original comment by darieca...@gmail.com on 28 Mar 2012 at 2:04

GoogleCodeExporter commented 8 years ago
new Date("2009-12-31 12:00:00 AM") is not parsed correctly by native JavaScript 
into a Date object. The code will create an invalid Date, which is why 
.equals() will return false. This string format is not supported by the native 
JavaScript new Date() constructor. If you wish to use this string date format, 
please use the DateJS Date.parse() function. 

Original comment by ge...@ext.net on 10 Apr 2012 at 5:53