[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,8 +332,10 @@ 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
// representing the day before.
// Reduce the time by the offset: // Reduce the time by the offset:
// Apply the correction to the date/time to get it UTC relative // Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000); date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
@@ -341,7 +343,6 @@ const CalendarUtils = {
// fix it for this event entry // fix it for this event entry
//duration = 24 * 60 * 60 * 1000; //duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date1 is " + date); 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()) {