Skip to content

Commit 6fca6d5

Browse files
authored
fix(DST): fix daylight saving time DST bug && add test (#354)
1 parent 969aced commit 6fca6d5

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/manipulate.test.js

+10
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,13 @@ it('Add Time days', () => {
5252
it('Subtract Time days', () => {
5353
expect(dayjs().subtract(1, 'days').valueOf()).toBe(moment().subtract(1, 'days').valueOf())
5454
})
55+
56+
it('Add Time days (DST)', () => {
57+
// change timezone before running test
58+
// New Zealand (-720)
59+
expect(dayjs('2018-04-01').add(1, 'd').format()).toBe(moment('2018-04-01').add(1, 'd').format())
60+
expect(dayjs('2018-03-28').add(1, 'w').format()).toBe(moment('2018-03-28').add(1, 'w').format())
61+
// London (-60)
62+
expect(dayjs('2018-10-28').add(1, 'd').format()).toBe(moment('2018-10-28').add(1, 'd').format())
63+
expect(dayjs('2018-10-26').add(1, 'w').format()).toBe(moment('2018-10-26').add(1, 'w').format())
64+
})

0 commit comments

Comments
 (0)