captbaritone / captbaritone/datejs

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

Open
#134 0 comments 0 reactions 0 assignees View on GitHub
auto-migrated Priority-Medium Type-Defect
Dominant language
JavaScript
Stars
1
Forks
0
PR merge metrics
No merged PRs in 30d

Description

```
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.