iamkun / iamkun/dayjs

Time format for 12:**PM returning wrong value.

Open
#2,361 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
Whenever I send either 12PM or 12:**PM based time interval that does not have a space between the time and the meridiem then it returns a midnight based time interval. If I send 12 PM then I get 12:00.

**Expected behavior**
Code: `dayjs(data.Time, ['h:mm A', 'h A', 'hA', 'h:mmA', 'h:mm a', 'h a', 'ha', 'h:mma']).format("HH:mm");`
When a time of 12PM is sent in to the formatted
Then I expect to get the time of 12:00
Instead I get 00:00

**Information**
- Day.js Version: v1.11.8
- OS: Windows 10
- Browser: Using inside of API and being called through an application
- Time zone: US, Central Standard Time

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the provided Day.js parsing and formatting call, comparing 12PM with 12 PM and the corresponding AM values. Trace the time-string parsing and meridiem handling entry points; done means compact 12PM input formats as noon (12:00) while equivalent AM input remains midnight (00:00), with regression coverage for the reported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.