kenhy / datejs

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

0:00 using "h" or "hh" shows up as 0:00am instead of 12:00am #134

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. date = new Date (2011, 10, 18, 0, 0);
2. date.toString("ddd MMM d, yyyy h:mmtt");

What is the expected output? What do you see instead?
12:00am should display. I see 0:00am.

What version of the product are you using? On what operating system?
1.0 Alpha-1
Mac OSX 10.7.2

Please provide any additional information below.
Here's the fix:
Change this:
case"hh":return 
p(self.getHours()<13?self.getHours():(self.getHours()-12));case"h":return 
self.getHours()<13?self.getHours():(self.getHours()-12);

to this:
case"hh":return 
p(self.getHours()<13?((self.getHours()%12)?self.getHours():12):(self.getHours()-
12));case"h":return 
self.getHours()<13?((self.getHours()%12)?self.getHours():12):(self.getHours()-12
);

Original issue reported on code.google.com by stephen....@gmail.com on 18 Oct 2011 at 2:08

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Verified, the above fix works well.  However The problem also manifests itself 
in the Date.parse() routine.  If you perform :

Date.parse("10/18/2011 12:00AM")

The date object after the parse appears to be 12:00 PM.

Original comment by transien...@gmail.com on 24 Oct 2011 at 7:04

GoogleCodeExporter commented 9 years ago
Issue is over six months old, assume that development of this library is dead?

Original comment by brett.wa...@gmail.com on 5 Sep 2012 at 8:07

GoogleCodeExporter commented 9 years ago
Works in the current build in my fork: https://github.com/abritinthebay/datejs/

Original comment by darkcr...@gmail.com on 15 Sep 2013 at 7:58