From 878c0be727a39bec10757689e6fd665bb43b3f11 Mon Sep 17 00:00:00 2001 From: Julian Dinter Date: Sun, 22 Aug 2021 14:16:02 +0200 Subject: [PATCH] [Fix] start time of calendar event gets corrected by time zone offset. --- modules/default/calendar/calendarutils.js | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/modules/default/calendar/calendarutils.js b/modules/default/calendar/calendarutils.js index ad24182f..32801a05 100644 --- a/modules/default/calendar/calendarutils.js +++ b/modules/default/calendar/calendarutils.js @@ -332,16 +332,17 @@ const CalendarUtils = { Log.debug("Fullday"); // If the offset is negative (east of GMT), where the problem is if (dateoffset < 0) { - // If the date hour is less than the offset - if (dh < Math.abs(dateoffset / 60)) { - // Reduce the time by the offset: - // Apply the correction to the date/time to get it UTC relative - date = new Date(date.getTime() - Math.abs(nowOffset) * 60000); - // the duration was calculated way back at the top before we could correct the start time.. - // fix it for this event entry - //duration = 24 * 60 * 60 * 1000; - Log.debug("new recurring date1 is " + date); - } + // Remove the offset, independently of the comparison between the date hour and the offset, + // since in the case that *date houre < offset*, the *new Date* command will handle this by + // representing the day before. + + // Reduce the time by the offset: + // Apply the correction to the date/time to get it UTC relative + date = new Date(date.getTime() - Math.abs(nowOffset) * 60000); + // the duration was calculated way back at the top before we could correct the start time.. + // fix it for this event entry + //duration = 24 * 60 * 60 * 1000; + Log.debug("new recurring date1 is " + date); } else { // if the timezones are the same, correct date if needed if (event.start.tz === moment.tz.guess()) {