Skip to content

Commit

Permalink
test: update zh-cn locale test
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun committed Dec 19, 2020
1 parent d5930b9 commit aaabd80
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions test/locale/zh-cn.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import moment from 'moment'
// import moment from 'moment'
import MockDate from 'mockdate'
import dayjs from '../../src'
import '../../src/locale/zh-cn'
Expand All @@ -12,10 +12,9 @@ afterEach(() => {
})

it('Meridiem', () => {
const dayjsObj = dayjs().locale('zh-cn')
const momentObj = moment().locale('zh-cn')
for (let i = 0; i <= 24; i += 1) {
expect(dayjsObj.add(i, 'hour').format('A'))
.toEqual(momentObj.clone().add(i, 'hour').format('A'))
}
// the '中午' is different to moment.js 11-13
expect(dayjs('2020-01-01 10:59:59').locale('zh-cn').format('A')).toEqual('上午')
expect(dayjs('2020-01-01 11:00:00').locale('zh-cn').format('A')).toEqual('中午')
expect(dayjs('2020-01-01 12:59:59').locale('zh-cn').format('A')).toEqual('中午')
expect(dayjs('2020-01-01 13:00:00').locale('zh-cn').format('A')).toEqual('下午')
})

0 comments on commit aaabd80

Please sign in to comment.