-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Kurdish (ku) locale has it's own form of meridiem texts which are: `AM` -> `پ.ن` `PM` -> `د.ن` The logic of determining which should be chosen is identical to the main logic from the library, the only change is localized strings for each case. Also tests are added to the corresponding locale to ensure it gets formatted correctly.
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import MockDate from 'mockdate' | ||
import dayjs from '../../src' | ||
import '../../src/locale/ku' | ||
|
||
beforeEach(() => { | ||
MockDate.set(new Date()) | ||
}) | ||
|
||
afterEach(() => { | ||
MockDate.reset() | ||
}) | ||
|
||
it('Format meridiem correctly', () => { | ||
for (let i = 0; i <= 23; i += 1) { | ||
const dayjsKu = dayjs() | ||
.startOf('day') | ||
.add(i, 'hour') | ||
expect(dayjsKu.locale('ku').format('h A')).toBe(`${i % 12 || 12} ${i < 12 ? 'پ.ن' : 'د.ن'}`) | ||
} | ||
}) |