Skip to content

Commit

Permalink
fix: update meridiem function to Kurdish (ku) locale (#1725)
Browse files Browse the repository at this point in the history
  • Loading branch information
akamfoad authored Mar 1, 2022
1 parent c7a3f73 commit efd3904
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/locale/ku.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const locale = {
LLL: 'D MMMM YYYY HH:mm',
LLLL: 'dddd, D MMMM YYYY HH:mm'
},
meridiem: hour => (hour < 12 ? 'پ.ن' : 'د.ن'),
relativeTime: {
future: 'له‌ %s',
past: '%s',
Expand Down
20 changes: 20 additions & 0 deletions test/locale/ku.test.js
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 ? 'پ.ن' : 'د.ن'}`)
}
})

0 comments on commit efd3904

Please sign in to comment.