Event Calendar adjustments for repeating events
All checks were successful
publish / publish (push) Successful in 24s
All checks were successful
publish / publish (push) Successful in 24s
This commit is contained in:
parent
d6102e568f
commit
1d81060d7c
1 changed files with 31 additions and 14 deletions
|
@ -67,27 +67,44 @@
|
|||
|
||||
console.log("ICS enthält", events.length, "Events");
|
||||
|
||||
const fcEvents = events
|
||||
.map(event => {
|
||||
const fcEvents = [];
|
||||
|
||||
events.forEach(event => {
|
||||
try {
|
||||
const icalEvent = new ICAL.Event(event);
|
||||
|
||||
if (icalEvent.isRecurring()) {
|
||||
const expand = new ICAL.RecurExpansion({
|
||||
component: event,
|
||||
dtstart: icalEvent.startDate
|
||||
});
|
||||
|
||||
for (let i = 0; i < 30; i++) {
|
||||
if (!expand.next()) break;
|
||||
|
||||
const next = expand.last;
|
||||
fcEvents.push({
|
||||
title: icalEvent.summary || "Ohne Titel",
|
||||
start: next.toJSDate(),
|
||||
allDay: icalEvent.startDate.isDate
|
||||
});
|
||||
}
|
||||
} else {
|
||||
const start = icalEvent.startDate?.toJSDate();
|
||||
const end = icalEvent.endDate?.toJSDate();
|
||||
if (!start) return;
|
||||
|
||||
if (!start) return null;
|
||||
|
||||
return {
|
||||
fcEvents.push({
|
||||
title: icalEvent.summary || "Ohne Titel",
|
||||
start: start,
|
||||
end: end,
|
||||
description: icalEvent.description || ""
|
||||
};
|
||||
allDay: icalEvent.startDate.isDate
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn("Fehler beim Parsen eines Events:", e);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Boolean);
|
||||
});
|
||||
|
||||
console.log("Nach dem Mapping:", fcEvents.length, "Events");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue