Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix DST issue in `eachDayOfInterval` that caused time in the days after DST change to have the shift as well.
- Loading branch information
1 parent
374cb3a
commit 48bbe0a
Showing
3 changed files
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// This is basic DST test for eachDayOfInterval | ||
|
||
import eachDayOfInterval from '../../../src/eachDayOfInterval' | ||
import assert from 'assert' | ||
|
||
if (process.env.TZ !== 'Asia/Damascus') | ||
throw new Error('The test must be run with TZ=Asia/Damascus') | ||
|
||
if (parseInt(process.version.match(/^v(\d+)\./)[1]) < 10) | ||
throw new Error('The test must be run on Node.js version >= 10') | ||
|
||
assert.deepEqual( | ||
eachDayOfInterval({ | ||
start: new Date(2020, 2, 26), | ||
end: new Date(2020, 2, 28) | ||
}).map(d => d.toString()), | ||
[ | ||
'Thu Mar 26 2020 00:00:00 GMT+0200 (Eastern European Standard Time)', | ||
'Fri Mar 27 2020 01:00:00 GMT+0300 (Eastern European Summer Time)', | ||
'Sat Mar 28 2020 00:00:00 GMT+0300 (Eastern European Summer Time)' | ||
] | ||
) |