respect the timezone from the ical event (#2361)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
buschco
2022-04-04 21:52:52 +00:00
committed by GitHub
co-authored by kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
parent ffff59dd00
commit 2d6cb1eb73
+4 -2
View File
@@ -248,10 +248,12 @@ export default abstract class BaseCalendarService implements Calendar {
const vcalendar = new ICAL.Component(jcalData);
const vevent = vcalendar.getFirstSubcomponent("vevent");
const event = new ICAL.Event(vevent);
const timezoneComp = vcalendar.getFirstSubcomponent("vtimezone");
const tzid: string = timezoneComp?.getFirstPropertyValue("tzid") ?? "UTC";
return {
start: event.startDate.toJSDate().toISOString(),
end: event.endDate.toJSDate().toISOString(),
start: dayjs.tz(event.startDate.toJSDate(), tzid).toISOString(),
end: dayjs.tz(event.endDate.toJSDate(), tzid).toISOString(),
};
});