Skip to content

Commit

Permalink
fix(DST): fix daylight saving time DST bug && add test (#354)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkun committed Sep 26, 2018
1 parent 969aced commit 6fca6d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/manipulate.test.js
Expand Up @@ -52,3 +52,13 @@ it('Add Time days', () => {
it('Subtract Time days', () => {
expect(dayjs().subtract(1, 'days').valueOf()).toBe(moment().subtract(1, 'days').valueOf())
})

it('Add Time days (DST)', () => {
// change timezone before running test
// New Zealand (-720)
expect(dayjs('2018-04-01').add(1, 'd').format()).toBe(moment('2018-04-01').add(1, 'd').format())
expect(dayjs('2018-03-28').add(1, 'w').format()).toBe(moment('2018-03-28').add(1, 'w').format())
// London (-60)
expect(dayjs('2018-10-28').add(1, 'd').format()).toBe(moment('2018-10-28').add(1, 'd').format())
expect(dayjs('2018-10-26').add(1, 'w').format()).toBe(moment('2018-10-26').add(1, 'w').format())
})

0 comments on commit 6fca6d5

Please sign in to comment.