Skip to content

Commit

Permalink
fix: fix utc plugin diff edge case (#1187)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun authored Nov 14, 2020
1 parent ef1979c commit 971b3d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/display.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ describe('Difference', () => {
expect(dayjs('2018-08-08').diff(dayjs('2018-09-08'), 'month')).toEqual(-1)
expect(dayjs('2018-01-01').diff(dayjs('2018-01-01'), 'month')).toEqual(0)
})

it('undefined edge case', () => {
expect(dayjs().diff(undefined, 'seconds')).toBeDefined()
})
})

it('Unix Timestamp (milliseconds)', () => {
Expand Down
4 changes: 4 additions & 0 deletions test/plugin/utc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,7 @@ it('utc keepLocalTime', () => {
expect(dd).toEqual(dm)
expect(vd).toEqual(vm)
})

it('utc diff undefined edge case', () => {
expect(dayjs().diff(undefined, 'seconds')).toBeDefined()
})

0 comments on commit 971b3d4

Please sign in to comment.