FIX: improves DST support of dates when recurrence is used (#7297)

This commit is contained in:
Joffrey JAFFEUX 2019-04-01 12:19:09 +02:00 committed by GitHub
parent 3cba10b9ca
commit d81f3ee2c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 1 deletions

View File

@ -185,8 +185,19 @@
const type = parts[1];
const diff = moment().diff(dateTime, type);
const add = Math.ceil(diff + count);
const wasDST = moment(dateTime.format()).isDST();
let dateTimeWithRecurrence = dateTime.add(add, type);
const isDST = moment(dateTimeWithRecurrence.format()).isDST();
return dateTime.add(add, type);
if (!wasDST && isDST) {
dateTimeWithRecurrence.subtract(1, "hour");
}
if (wasDST && !isDST) {
dateTimeWithRecurrence.add(1, "hour");
}
return dateTimeWithRecurrence;
}
function _createDateTimeRange(dateTime, timezone) {