feat:#4 updated router and views

This commit is contained in:
Elmar Kresse
2024-05-19 21:29:59 +02:00
parent 1c22c2c227
commit 6e9dfdba31
10 changed files with 149 additions and 26 deletions

View File

@@ -0,0 +1,24 @@
import ICAL from 'ical.js';
import { CalendarComponent } from 'ical';
export function parseICalData(icalData: string | undefined) {
if (icalData === undefined || !icalData) {
return [];
}
const jCalData = ICAL.parse(icalData);
const comp = new ICAL.Component(jCalData);
const vEvents = comp.getAllSubcomponents('vevent');
return vEvents.map((vevent: CalendarComponent) => {
const event = new ICAL.Event(vevent);
return {
title: event.summary,
start: event.startDate.toJSDate(),
end: event.endDate.toJSDate(),
allDay: event.startDate.isDate,
// Include other properties as needed
};
});
}