From 63983c9d606ad6ae0c24c7836426cd972199d4a6 Mon Sep 17 00:00:00 2001 From: zomars Date: Sun, 12 Jun 2022 15:23:14 -0600 Subject: [PATCH] Prevents caldav recurring events errors to unblock availability --- packages/lib/CalendarService.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/lib/CalendarService.ts b/packages/lib/CalendarService.ts index bcb50be46d..c13b480469 100644 --- a/packages/lib/CalendarService.ts +++ b/packages/lib/CalendarService.ts @@ -268,11 +268,22 @@ export default abstract class BaseCalendarService implements Calendar { let current; let currentEvent; let currentStart; + let currentError; do { maxIterations -= 1; current = iterator.next(); - currentEvent = event.getOccurrenceDetails(current); + + try { + // @see https://github.com/mozilla-comm/ical.js/issues/514 + currentEvent = event.getOccurrenceDetails(current); + } catch (error) { + if (error instanceof Error && error.message !== currentError) { + currentError = error.message; + console.log("error", error); + } + } + if (!currentEvent) return; // as pointed out in https://datatracker.ietf.org/doc/html/rfc4791#section-9.6.5 // recurring events are always in utc currentStart = dayjs(currentEvent.startDate.toJSDate());