FIX: improves DST support of dates when recurrence is used (#7297)
This commit is contained in:
parent
3cba10b9ca
commit
d81f3ee2c2
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue