Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework toDate and extract parseISO #1023

Merged
merged 7 commits into from Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -748,6 +748,9 @@ for the list of changes made since `v2.0.0-alpha.1`.

- [Fixed DST issue](https://github.com/date-fns/date-fns/pull/1003). See [#972](https://github.com/date-fns/date-fns/issues/972) and [#992](https://github.com/date-fns/date-fns/issues/992) for more details.

- Fixed DST issue in `eachDayOfInterval` that caused time in the days
after DST change to have the shift as well.

- Fix bug in Galician locale caused by incorrect usage of `getHours`
instead of `getUTCHours`.

Expand Down
1 change: 1 addition & 0 deletions scripts/test/dst.sh
Expand Up @@ -10,3 +10,4 @@ export PATH="$(yarn bin):$PATH"

env TZ=America/Sao_Paulo babel-node ./test/dst/parseISO/basic.js
env TZ=Pacific/Apia babel-node ./test/dst/parseISO/samoa.js
env TZ=Asia/Damascus babel-node ./test/dst/eachDayOfInterval/basic.js
22 changes: 22 additions & 0 deletions test/dst/eachDayOfInterval/basic.js
@@ -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)'
]
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've messed up with the rebase, so for those who are looking for the actual fix: https://github.com/date-fns/date-fns/pull/1023/files#diff-5a48fe3ae25f8ac62336262cb0acd5e2