iamkun / iamkun/dayjs

12:00 am is confused with 12:00 pm in Arabic local.

Open
#2,711 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

When having the Arabic local enabled, Dayjs has trouble formatting 12:00 pm hours of the day.

```ts
import dayjs from 'dayjs'
import "dayjs/locale/ar";

dayjs.locale("ar");
// The symbol `ص` is for "day hours"
// 12 am is translated to `12 ص` which is correct and expected.
dayjs("2024-08-18 12:00 am").format("hh:mm a") // => 12:00 ص
// the `12 pm` is translated to `12 ص` which is not correct and should be translated to `12 م` which is the symbol for "night hours"
dayjs("2024-08-18 12:00 pm").format("hh:mm a") // => 12:00 ص
```

This will confuse the user about what time of the day it is.

### Expected Behavior
`12:00 pm` should be translated to `12:00 م` using the nighttime symbol ([here](https://github.com/iamkun/dayjs/blob/dev/src/locale/ar.js#L40))

**Information**
- Day.js Version: ^1.11.12
- OS: WSL (WINDOW)
- Browser: Chrome 127.0.6533.120
- Time zone: GMT+03

Contributor guide

Open the contributing guide

Research direction

Start by inspecting src/locale/ar.js, especially the meridiem formatting referenced in the issue. Reproduce the two Day.js examples with the Arabic locale and verify that 12:00 am remains 12:00 ص while 12:00 pm formats as 12:00 م.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
localization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.