fixes UTC consideration in CalDAV (#5827)

* fixes UTC consideration

* typecheck fix

* code quality

* comment location

Co-authored-by: Alex van Andel <[email protected]>
This commit is contained in:
Syed Ali ShahbazandAlex van Andel authored and GitHub committed 2022-12-02 19:46:38 +00:00
1 parent 3be6c05722
commit d3e4d26fa5
1 file changed
+3 -1
+3 -1
View File
@@ -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");