Fix with ical convert to zone (#2377)
Co-authored-by: Omar López <zomars@me.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>pull/2388/head^2
parent
f8b7e17fda
commit
9d512e70c4
|
@ -248,12 +248,16 @@ 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";
|
||||
const vtimezone = vcalendar.getFirstSubcomponent("vtimezone");
|
||||
if (vtimezone) {
|
||||
const zone = new ICAL.Timezone(vtimezone);
|
||||
event.startDate = event.startDate.convertToZone(zone);
|
||||
event.endDate = event.endDate.convertToZone(zone);
|
||||
}
|
||||
|
||||
return {
|
||||
start: dayjs.tz(event.startDate.toJSDate(), tzid).toISOString(),
|
||||
end: dayjs.tz(event.endDate.toJSDate(), tzid).toISOString(),
|
||||
start: dayjs(event.startDate.toJSDate()).toISOString(),
|
||||
end: dayjs(event.endDate.toJSDate()).toISOString(),
|
||||
};
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue