Skip to content

Commit

Permalink
add test for zh-tw locale
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin82222 committed Dec 5, 2022
1 parent a0abee2 commit 2f1db06
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/locale/zh-tw.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import dayjs from '../../src'
import advancedFormat from '../../src/plugin/advancedFormat'
import weekOfYear from '../../src/plugin/weekOfYear'
import '../../src/locale/zh'
import '../../src/locale/zh-tw'

dayjs.extend(advancedFormat).extend(weekOfYear)

const zh = dayjs().locale('zh')
const zhTW = dayjs().locale('zh-tw')

test('ordinal', () => {
expect(zh.format('wo')).toEqual(`${zh.format('w')}周`)
expect(zhTW.format('wo')).toEqual(`${zhTW.format('w')}週`)
})

test('Meridiem', () => {
for (let i = 0; i <= 24; i += 1) {
expect(zh.add(i, 'hour').format('A')).toBe(zhTW.add(i, 'hour').format('A'))
}
})

0 comments on commit 2f1db06

Please sign in to comment.