Skip to content

Commit c93c85e

Browse files
authored
fix: ordinal for nl not working (iamkun#2011)
1 parent dd192a7 commit c93c85e

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/locale/nl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const locale = {
88
weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'),
99
months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split('_'),
1010
monthsShort: 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
11-
ordinal: n => `${n}${n === 1 || n === 8 || n >= 20 ? 'ste' : 'de'}`,
11+
ordinal: n => `[${n}${n === 1 || n === 8 || n >= 20 ? 'ste' : 'de'}]`,
1212
weekStart: 1,
1313
yearStart: 4,
1414
formats: {

test/plugin/advancedFormat.test.js

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import weekYear from '../../src/plugin/weekYear'
88
import timezone from '../../src/plugin/timezone'
99
import utc from '../../src/plugin/utc'
1010
import '../../src/locale/zh-cn'
11+
import '../../src/locale/nl'
1112

1213
dayjs.extend(utc)
1314
dayjs.extend(timezone)
@@ -51,12 +52,16 @@ it('Format Day of Month Do 1 - 31', () => {
5152
expect(dayjs(d).format('Do')).toBe(moment(d).format('Do'))
5253
d = '2018-05-04 00:00:00.000'
5354
expect(dayjs(d).format('Do')).toBe(moment(d).format('Do'))
55+
d = '2018-05-08 00:00:00.000'
56+
expect(dayjs(d).locale('nl').format('Do')).toBe(moment(d).locale('nl').format('Do'))
5457
d = '2018-05-11'
5558
expect(dayjs(d).format('Do')).toBe(moment(d).format('Do'))
5659
d = '2018-05-12'
5760
expect(dayjs(d).format('Do')).toBe(moment(d).format('Do'))
5861
d = '2018-05-13'
5962
expect(dayjs(d).format('Do')).toBe(moment(d).format('Do'))
63+
d = '2018-05-19 00:00:00.000'
64+
expect(dayjs(d).locale('nl').format('Do')).toBe(moment(d).locale('nl').format('Do'))
6065
d = '2018-05-22'
6166
expect(dayjs(d).format('Do')).toBe(moment(d).format('Do'))
6267
})

0 commit comments

Comments
 (0)