feat(calendar): add METHOD property to calendar component if provided

This commit is contained in:
Ryan Mwangi 2024-11-19 15:59:23 +03:00
parent 2283b82ba7
commit 5e3e8eab5b
1 changed files with 10 additions and 0 deletions

View File

@ -43,6 +43,16 @@ export function addEventsToCalendar(calendarComponent, results, overrideFlag = f
const parsed = ICAL.parse(result.data);
const component = new ICAL.Component(parsed);
// Extract METHOD from the parsed data (if available)
const method = component.getFirstPropertyValue('method');
if (method) {
console.log(`Extracted METHOD: ${method}`);
// Only add the METHOD property once
if (!calendarComponent.getFirstPropertyValue('method')) {
calendarComponent.updatePropertyWithValue('method', method.toUpperCase());
}
}
// Extract and add VTIMEZONE components
const timezones = component.getAllSubcomponents('vtimezone');
timezones.forEach((timezone) => {