fix: Kalender-Toggle sofort wirksam + Tint für mehrtägige Ganztags-Events

- fetchAndRender(true) beim Ein-/Ausblenden eines Kalenders erzwingt
  einen Neu-Abruf statt Cache-Treffer, damit die Änderung sofort sichtbar ist
- Tint-Berechnung in der Wochenansicht berücksichtigt jetzt auch
  mehrtägige Ganztags-Events (z.B. Urlaub), nicht nur mehrtägige
  Termin-Events — exclusive Enddaten werden dabei korrekt normalisiert
This commit is contained in:
Scarriffle
2026-04-08 21:59:41 +02:00
parent 7070e23cc6
commit 4c8face22a
2 changed files with 12 additions and 3 deletions

View File

@@ -486,7 +486,7 @@ function renderCalendarList() {
if (cal) cal.enabled = cb.checked;
}
}
fetchAndRender();
fetchAndRender(true);
});
});

View File

@@ -20,6 +20,15 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC
const timedEvs = events.filter(ev => !ev.allDay);
// Multi-day timed events: timed but spanning more than one calendar day
const multiDayTimedEvs = timedEvs.filter(ev => !isSameDay(new Date(ev.start), new Date(ev.end)));
// Multi-day all-day events (exclusive end → subtract 1 day before comparing)
const multiDayAllDayEvs = allDayEvs.filter(ev => {
const s = new Date(ev.start);
const e = new Date(ev.end);
if (e > s) e.setDate(e.getDate() - 1); // exclusive → inclusive
return !isSameDay(s, e);
});
// All events that should generate a column background tint
const tintEvs = [...multiDayTimedEvs, ...multiDayAllDayEvs];
// Returns true if event overlaps any part of the given day
function spansDay(ev, day) {
@@ -121,8 +130,8 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC
</div>`;
}).join('');
// Background tint for days covered by multi-day timed events
const tintHtml = multiDayTimedEvs.filter(ev => spansDay(ev, day)).map(ev => {
// Background tint for days covered by multi-day events (timed or all-day)
const tintHtml = tintEvs.filter(ev => spansDay(ev, day)).map(ev => {
const color = ev.color || ev.calendarColor || '#4285f4';
return `<div class="col-span-tint" style="background:${color}26"></div>`;
}).join('');