[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"); Log.debug("Fullday");
// If the offset is negative (east of GMT), where the problem is // If the offset is negative (east of GMT), where the problem is
if (dateoffset < 0) { if (dateoffset < 0) {
// If the date hour is less than the offset // Remove the offset, independently of the comparison between the date hour and the offset,
if (dh < Math.abs(dateoffset / 60)) { // since in the case that *date houre < offset*, the *new Date* command will handle this by
// Reduce the time by the offset: // representing the day before.
// Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000); // Reduce the time by the offset:
// the duration was calculated way back at the top before we could correct the start time.. // Apply the correction to the date/time to get it UTC relative
// fix it for this event entry date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
//duration = 24 * 60 * 60 * 1000; // the duration was calculated way back at the top before we could correct the start time..
Log.debug("new recurring date1 is " + date); // fix it for this event entry
} //duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date1 is " + date);
} else { } else {
// if the timezones are the same, correct date if needed // if the timezones are the same, correct date if needed
if (event.start.tz === moment.tz.guess()) { if (event.start.tz === moment.tz.guess()) {