Skip to content

Commit 548b217

Browse files
committed
test: update test case
1 parent 1a199d3 commit 548b217

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

test/display.test.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,7 @@ it('As ISO 8601 String -> toISOString e.g. 2013-02-04T22:44:30.652Z', () => {
264264
it('Year 1 formatted with YYYY should pad with zeroes', () => {
265265
const date = new Date(1, 0, 1)
266266
date.setUTCFullYear(1) // Required because 0-99 are parsed as 19xx in JS: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/Date#year
267-
expect(dayjs(date).format('YYYY')).toBe('0002')
268-
})
269-
270-
it('Year 1 formatting matches moment format', () => {
271-
const date = new Date(1, 0, 1)
272-
date.setUTCFullYear(1)
273-
expect(dayjs(date).format('YYYY')).toBe(moment(date).format('YYYY'))
267+
const res = dayjs(date).format('YYYY')
268+
expect(res.slice(0, 3)).toBe('000') // because of timezone, the result might be 0000 0001 or 0002
269+
expect(res).toBe(moment(date).format('YYYY'))
274270
})

0 commit comments

Comments
 (0)