mirror of
https://gitlab.dit.htwk-leipzig.de/htwk-software/htwkalender-pwa.git
synced 2026-01-17 14:12:25 +01:00
feat:#4 updated router and views
This commit is contained in:
@@ -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
|
||||
};
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user