From 79e99e18ea770337a94c8fd5d0f1dc5c2601a68c Mon Sep 17 00:00:00 2001 From: "J. Kenzal Hunter" Date: Fri, 8 Sep 2023 01:44:49 -0400 Subject: [PATCH] Cross UTC time fix (#3175) Update calendarfetcherutils.js to force recurrence date time to be the same as event datetime I found an issue with one of my calendars displaying the wrong time for certain recurring events. Each event was set up by someone in a different timezone (Central European) than my own (Eastern US). I traced the issue back to the `Rrule.between()` method generating odd time portions under certain circumstances. The fix I found was to set the UTC time portion of the recurrence datetime to be the same as the UTC time portion of the event start date. This resolved the issues with the maladjusted event times, and had no effect on other event times. While there may be edge cases that are affected, I have been unable to locate any. --------- Co-authored-by: Veeck --- CHANGELOG.md | 1 + modules/default/calendar/calendarfetcherutils.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e9ca2aed..9fd6cf86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ _This release is scheduled to be released on 2023-10-01._ - Fix undefined formatTime method in clock module (#3143) - Fix clientonly startup fails after async added (#3151) - Fix electron width/heigth when using xrandr under bullseye +- Fix time issue with certain recurring events in calendar module - Fix ipWhiteList test (#3179) ## [2.24.0] - 2023-07-01 diff --git a/modules/default/calendar/calendarfetcherutils.js b/modules/default/calendar/calendarfetcherutils.js index d425f0a4..34cc2578 100644 --- a/modules/default/calendar/calendarfetcherutils.js +++ b/modules/default/calendar/calendarfetcherutils.js @@ -313,6 +313,9 @@ const CalendarFetcherUtils = { let curEvent = event; let showRecurrence = true; + // set the time information in the date to equal the time information in the event + date.setUTCHours(curEvent.start.getUTCHours(), curEvent.start.getUTCMinutes(), curEvent.start.getUTCSeconds(), curEvent.start.getUTCMilliseconds()); + // Get the offset of today where we are processing // This will be the correction, we need to apply. let nowOffset = new Date().getTimezoneOffset();