mirror of
https://github.com/discourse/discourse.git
synced 2025-02-07 20:08:26 +00:00
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 type = parts[1];
|
||||||
const diff = moment().diff(dateTime, type);
|
const diff = moment().diff(dateTime, type);
|
||||||
const add = Math.ceil(diff + count);
|
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) {
|
function _createDateTimeRange(dateTime, timezone) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user