fixes UTC consideration in CalDAV (#5827)
* fixes UTC consideration * typecheck fix * code quality * comment location Co-authored-by: Alex van Andel <me@alexvanandel.com>pull/5825/head
parent
3be6c05722
commit
d3e4d26fa5
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue