Merge pull request #2071 from chamakura/develop

Fixing double conversion of time between UTC and local timezone
This commit is contained in:
Michael Teeuw 2020-07-05 22:06:59 +02:00 committed by GitHub
commit 862bf78e63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 9 deletions

View File

@ -468,11 +468,6 @@ Module.register("calendar", {
for (var e in calendar) { for (var e in calendar) {
var event = JSON.parse(JSON.stringify(calendar[e])); // clone object var event = JSON.parse(JSON.stringify(calendar[e])); // clone object
// correct data for the current timezone
var offset = -(new Date().getTimezoneOffset() * 60 * 1000);
event.startDate = event.startDate - offset;
event.endDate = event.endDate - offset;
if (event.endDate < now) { if (event.endDate < now) {
continue; continue;
} }

View File

@ -186,10 +186,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumNu
// kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time
const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate();
const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate();
const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction); const dates = rule.between(pastLocal, futureLocal, true, limitFunction);
const dates = datesLocal.map(function (dateLocal) {
return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate();
});
// The "dates" array contains the set of dates within our desired date range range that are valid // The "dates" array contains the set of dates within our desired date range range that are valid
// for the recurrence rule. *However*, it's possible for us to have a specific recurrence that // for the recurrence rule. *However*, it's possible for us to have a specific recurrence that