Skip to content

Commit

Permalink
Don't apply DST offset in parseISO when parsing date, fixes #1449
Browse files Browse the repository at this point in the history
  • Loading branch information
kalekseev committed Sep 26, 2019
1 parent 812c340 commit 751aba0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/parseISO/index.js
Expand Up @@ -136,13 +136,15 @@ export default function parseISO(argument, dirtyOptions) {

offset = getTimezoneOffsetInMilliseconds(fullTimeDate)

// Adjust time when it's coming from DST
var fullTimeDateNextDay = new Date(fullTime)
fullTimeDateNextDay.setDate(fullTimeDate.getDate() + 1)
var offsetDiff =
getTimezoneOffsetInMilliseconds(fullTimeDateNextDay) - offset
if (offsetDiff > 0) {
offset += offsetDiff
if (dateStrings.time) {
// Adjust time when it's coming from DST
var fullTimeDateNextDay = new Date(fullTime)
fullTimeDateNextDay.setDate(fullTimeDate.getDate() + 1)
var offsetDiff =
getTimezoneOffsetInMilliseconds(fullTimeDateNextDay) - offset
if (offsetDiff > 0) {
offset += offsetDiff
}
}
}

Expand Down

0 comments on commit 751aba0

Please sign in to comment.