[Fix] start time of calendar event gets corrected by time zone offset.

This commit is contained in:
Julian Dinter
2021-08-22 14:16:02 +02:00
parent e7f06f5c0c
commit 878c0be727

View File

@@ -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()) {