iamkun / iamkun/dayjs

Wrong meridiem in Arabic locale when time is 12 PM

Open
#2,951 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.8k
PR merge metrics
No merged PRs in 30d

Description

Hi, I noticed a bug when using the Arabic locale (ar-sa) in Day.js

When the time is 12 PM Day.js returns the meridiem as "ص" (AM) instead of "م" (PM)

This only happens at 12 PM other PM hours like 1 PM, 2 PM, etc.. work fine

I also tested it using Vitest and the test fails for the same reason

So it seems like the Arabic locale logic doesn’t handle 12 PM correctly

```

import { describe, expect, test } from "vitest";
import dayjs from "dayjs";
import "dayjs/locale/ar-sa";

describe("Dayjs Arabic & English", () => {
test("12:41 PM should be م in Arabic", () => {
const result = dayjs("2025-10-28T09:41:10.000000Z").locale("ar-sa").format("hh:mm a");
expect(result).toBe("12:41 م");
});

test("12:41 PM should be pm in English", () => {
const result = dayjs("2025-10-28T09:41:10.000000Z").format("hh:mm a");
expect(result).toBe("12:41 pm");
});
});
```

```

AssertionError: expected '12:41 ص' to be '12:41 م' // Object.is equality

Expected: "12:41 م"
Received: "12:41 ص"
```

Contributor guide

Open the contributing guide

Research direction

Start with the provided Vitest reproduction and the ar-sa locale logic, then trace how 12 PM is mapped to the Arabic meridiem. Done when the test expects "12:41 م" while the English expectation remains "12:41 pm".

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.