Event Calendar adjustments
This commit is contained in:
parent
e464580b86
commit
e53d9bbc51
2 changed files with 28 additions and 9 deletions
|
@ -59,6 +59,9 @@ window.toggleDetails = function (element) {
|
|||
minusIcon.style.display = isExpanded ? 'inline' : 'none';
|
||||
};
|
||||
|
||||
/* ========================
|
||||
News Feed
|
||||
======================== */
|
||||
function renderFeedEntries(data) {
|
||||
const container = document.getElementById('feed');
|
||||
if (!container) return;
|
||||
|
|
|
@ -65,15 +65,31 @@
|
|||
const comp = new ICAL.Component(jcalData, null);
|
||||
const events = comp.getAllSubcomponents('vevent');
|
||||
|
||||
const fcEvents = events.map(event => {
|
||||
const icalEvent = new ICAL.Event(event);
|
||||
return {
|
||||
title: icalEvent.summary,
|
||||
start: icalEvent.startDate.toJSDate(),
|
||||
end: icalEvent.endDate.toJSDate(),
|
||||
description: icalEvent.description
|
||||
};
|
||||
});
|
||||
console.log("ICS enthält", events.length, "Events");
|
||||
|
||||
const fcEvents = events
|
||||
.map(event => {
|
||||
try {
|
||||
const icalEvent = new ICAL.Event(event);
|
||||
const start = icalEvent.startDate?.toJSDate();
|
||||
const end = icalEvent.endDate?.toJSDate();
|
||||
|
||||
if (!start) return null;
|
||||
|
||||
return {
|
||||
title: icalEvent.summary || "Ohne Titel",
|
||||
start: start,
|
||||
end: end,
|
||||
description: icalEvent.description || ""
|
||||
};
|
||||
} catch (e) {
|
||||
console.warn("Fehler beim Parsen eines Events:", e);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Boolean);
|
||||
|
||||
console.log("Nach dem Mapping:", fcEvents.length, "Events");
|
||||
|
||||
calendar.addEventSource(fcEvents);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue