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';
|
minusIcon.style.display = isExpanded ? 'inline' : 'none';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* ========================
|
||||||
|
News Feed
|
||||||
|
======================== */
|
||||||
function renderFeedEntries(data) {
|
function renderFeedEntries(data) {
|
||||||
const container = document.getElementById('feed');
|
const container = document.getElementById('feed');
|
||||||
if (!container) return;
|
if (!container) return;
|
||||||
|
|
|
@ -65,15 +65,31 @@
|
||||||
const comp = new ICAL.Component(jcalData, null);
|
const comp = new ICAL.Component(jcalData, null);
|
||||||
const events = comp.getAllSubcomponents('vevent');
|
const events = comp.getAllSubcomponents('vevent');
|
||||||
|
|
||||||
const fcEvents = events.map(event => {
|
console.log("ICS enthält", events.length, "Events");
|
||||||
|
|
||||||
|
const fcEvents = events
|
||||||
|
.map(event => {
|
||||||
|
try {
|
||||||
const icalEvent = new ICAL.Event(event);
|
const icalEvent = new ICAL.Event(event);
|
||||||
|
const start = icalEvent.startDate?.toJSDate();
|
||||||
|
const end = icalEvent.endDate?.toJSDate();
|
||||||
|
|
||||||
|
if (!start) return null;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
title: icalEvent.summary,
|
title: icalEvent.summary || "Ohne Titel",
|
||||||
start: icalEvent.startDate.toJSDate(),
|
start: start,
|
||||||
end: icalEvent.endDate.toJSDate(),
|
end: end,
|
||||||
description: icalEvent.description
|
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);
|
calendar.addEventSource(fcEvents);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue