captbaritone / captbaritone/datejs

Logic for 12:00 AM/PM is backwards

Open
#141 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.parseExact('12:12 AM', 'h:mm tt').toString('yyyy-MM-dd HH:mm:ss'); //
returns '2011-12-01 12:12:00'
2. Date.parseExact('12:12 PM', 'h:mm tt').toString('yyyy-MM-dd HH:mm:ss'); //
returns '2011-12-02 00:12:00'

What is the expected output? What do you see instead?

I should get:
1. '12:00 AM' => '2011-12-01 00:12:00'
2. '12:00 PM' => '2011-12-02 12:12:00'

Instead I get:
1. '12:00 AM' => '2011-12-01 12:12:00'
2. '12:00 PM' => '2011-12-02 00:12:00'

What version of the product are you using? On what operating system?
Version: 1.0 Alpha-1
Build Date: 13-Nov-2007
Win-d'oh!s Vista
Firefox 8.0

Please provide any additional information below.

The logic for 12:00 AM/PM is backwards:
* 12:00 AM is supposed to be equal to 00:00 hours (midnight)
* 12:00 PM is supposed to be equal to 12:00 hours (noon/midday)

It looks like 12:00 PM is also wrapping to the next day, which it shouldn't
since it is supposed to be the middle of the current day.
```

Original issue reported on code.google.com by `JianHouZi` on 29 Dec 2011 at 2:03

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.