Fixing double conversion of time between UTC and local timezone

This commit is contained in:
chamakura 2020-07-04 20:12:34 -07:00
parent 73322c96a6
commit 309a18e9c0
2 changed files with 6 additions and 9 deletions

View File

@ -468,11 +468,6 @@ Module.register("calendar", {
for (var e in calendar) {
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) {
continue;
}

View File

@ -186,10 +186,12 @@ 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
const pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate();
const futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate();
const datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction);
const dates = datesLocal.map(function (dateLocal) {
return moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate();
});
const dates = rule.between(pastLocal, futureLocal, true, limitFunction);
if (getTitleFromEvent(event).search("Manageando") > -1) {
console.log(startDate);
console.log(event);
console.log(rule);
}
// 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