From d1be1ec3e013e728f5732e3c07acaf2734fff43d Mon Sep 17 00:00:00 2001 From: Joshua Kriegshauser Date: Wed, 25 Oct 2023 20:24:57 -0700 Subject: [PATCH] Fix issue #3250 --- CHANGELOG.md | 1 + modules/default/calendar/calendarfetcherutils.js | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9819331484..6e719ca5ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,7 @@ _This release is scheduled to be released on 2024-01-01._ - Fix newsfeed module for feeds using "a10:updated" tag (#3238) - Fix issue template (#3167) - Hotfix for failing unit test (#3254) +- Fix calendar events sometimes not respecting deleted events (#3250) ## [2.25.0] - 2023-10-01 diff --git a/modules/default/calendar/calendarfetcherutils.js b/modules/default/calendar/calendarfetcherutils.js index 34cc2578c6..3a90ae7ece 100644 --- a/modules/default/calendar/calendarfetcherutils.js +++ b/modules/default/calendar/calendarfetcherutils.js @@ -305,11 +305,6 @@ const CalendarFetcherUtils = { // Loop through the set of date entries to see which recurrences should be added to our event list. for (let d in dates) { let date = dates[d]; - // Remove the time information of each date by using its substring, using the following method: - // .toISOString().substring(0,10). - // since the date is given as ISOString with YYYY-MM-DDTHH:MM:SS.SSSZ - // (see https://momentjs.com/docs/#/displaying/as-iso-string/). - const dateKey = date.toISOString().substring(0, 10); let curEvent = event; let showRecurrence = true; @@ -402,6 +397,13 @@ const CalendarFetcherUtils = { let adjustDays = CalendarFetcherUtils.calculateTimezoneAdjustment(event, date); + // Remove the time information of each date by using its substring, using the following method: + // .toISOString().substring(0,10). + // since the date is given as ISOString with YYYY-MM-DDTHH:MM:SS.SSSZ + // (see https://momentjs.com/docs/#/displaying/as-iso-string/). + // This must be done after `date` is adjusted + const dateKey = date.toISOString().substring(0, 10); + // For each date that we're checking, it's possible that there is a recurrence override for that one day. if (curEvent.recurrences !== undefined && curEvent.recurrences[dateKey] !== undefined) { // We found an override, so for this recurrence, use a potentially different title, start date, and duration.