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");
|
console.log("ICS enthält", events.length, "Events");
|
||||||
|
|
||||||
const fcEvents = events
|
const fcEvents = [];
|
||||||
.map(event => {
|
|
||||||
try {
|
events.forEach(event => {
|
||||||
const icalEvent = new ICAL.Event(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 start = icalEvent.startDate?.toJSDate();
|
||||||
const end = icalEvent.endDate?.toJSDate();
|
const end = icalEvent.endDate?.toJSDate();
|
||||||
|
if (!start) return;
|
||||||
|
|
||||||
if (!start) return null;
|
fcEvents.push({
|
||||||
|
|
||||||
return {
|
|
||||||
title: icalEvent.summary || "Ohne Titel",
|
title: icalEvent.summary || "Ohne Titel",
|
||||||
start: start,
|
start: start,
|
||||||
end: end,
|
end: end,
|
||||||
description: icalEvent.description || ""
|
allDay: icalEvent.startDate.isDate
|
||||||
};
|
});
|
||||||
} catch (e) {
|
|
||||||
console.warn("Fehler beim Parsen eines Events:", e);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
})
|
} catch (e) {
|
||||||
.filter(Boolean);
|
console.warn("Fehler beim Parsen eines Events:", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
console.log("Nach dem Mapping:", fcEvents.length, "Events");
|
console.log("Nach dem Mapping:", fcEvents.length, "Events");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue