Skip to content

Scheduling infrastructure for absolutely everyone.

fixes UTC consideration in CalDAV (#5827)

Syed Ali Shahbazd3e4d26fa50c
diff --git a/packages/lib/CalendarService.ts b/packages/lib/CalendarService.ts
index 7e51861bfa0..38cf6c6d282 100644
--- a/packages/lib/CalendarService.ts
+++ b/packages/lib/CalendarService.ts
@@ -313,7 +313,9 @@ export default abstract class BaseCalendarService implements Calendar {
const event = new ICAL.Event(vevent);
const dtstart: { [key: string]: string } | undefined = vevent?.getFirstPropertyValue("dtstart");
const timezone = dtstart ? dtstart["timezone"] : undefined;
- const tzid: string | undefined = vevent?.getFirstPropertyValue("tzid") || timezone;
+ // We check if the dtstart timezone is in UTC which is actually represented by Z instead, but not recognized as that in ICAL.js as UTC
+ const isUTC = timezone === "Z";
+ const tzid: string | undefined = vevent?.getFirstPropertyValue("tzid") || isUTC ? "UTC" : timezone;
// In case of icalendar, when only tzid is available without vtimezone, we need to add vtimezone explicitly to take care of timezone diff
if (!vcalendar.getFirstSubcomponent("vtimezone") && tzid) {
const timezoneComp = new ICAL.Component("vtimezone");