Skip to content

Commit

Permalink
Fix: Calendar widget iCal integration catch RRule failures (#2706)
Browse files Browse the repository at this point in the history
  • Loading branch information
shamoon authored Jan 20, 2024
1 parent f6ca3f5 commit cca747c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/widgets/calendar/integrations/ical.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,16 @@ export default function Integration({ config, params, setEvents, hideErrors, tim

const recurrenceOptions = event?.recurrenceRule?.origOptions;
if (recurrenceOptions && Object.keys(recurrenceOptions).length !== 0) {
const rule = new RRule(recurrenceOptions);
const recurringEvents = rule.between(startDate.toJSDate(), endDate.toJSDate());

recurringEvents.forEach((date, i) => eventToAdd(date, i, "recurring"));
return;
try {
const rule = new RRule(recurrenceOptions);
const recurringEvents = rule.between(startDate.toJSDate(), endDate.toJSDate());

recurringEvents.forEach((date, i) => eventToAdd(date, i, "recurring"));
return;
} catch (e) {
// eslint-disable-next-line no-console
console.error("Unable to parse recurring events from iCal: %s", e);
}
}

event.matchingDates.forEach((date, i) => eventToAdd(date, i, "single"));
Expand Down

0 comments on commit cca747c

Please sign in to comment.