fix: add timezone fallback for event creation

- Fix timezone lookup error in calendarEventToJCal
- Add UTC fallback when timezone not found
This commit is contained in:
lenhanphung
2025-09-17 18:12:53 +07:00
parent c701fadcf4
commit 0d662358cd
+10 -1
View File
@@ -234,8 +234,17 @@ export function calendarEventToJCal(
]);
});
const timezoneData = TIMEZONES.zones[event.timezone];
if (!timezoneData) {
const vtimezone = new ICAL.Timezone({
component: TIMEZONES.zones["Etc/UTC"].ics,
tzid: "Etc/UTC",
});
return ["vcalendar", [], [vevent, vtimezone.component.jCal]];
}
const vtimezone = new ICAL.Timezone({
component: TIMEZONES.zones[event.timezone].ics,
component: timezoneData.ics,
tzid: event.timezone,
});
return ["vcalendar", [], [vevent, vtimezone.component.jCal]];