respect the timezone from the ical event (#2361)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
pull/2377/head
buschco 2022-04-04 23:52:52 +02:00 committed by GitHub
parent ffff59dd00
commit 2d6cb1eb73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

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(),
};
});