From 5a7d8ad362f718facf59cb6636dc60f8af8a4869 Mon Sep 17 00:00:00 2001 From: Scarriffle Date: Wed, 8 Apr 2026 22:24:05 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Tint=20f=C3=BCr=20mehrt=C3=A4gige=20Ganz?= =?UTF-8?q?tags-Events=20korrekt=20via=20alldayLayout=20Der=20bisherige=20?= =?UTF-8?q?multiDayAllDayEvs-Filter=20hatte=20einen=20Timezone-Fehler=20be?= =?UTF-8?q?i=20der=20Datumsberechnung=20(UTC-Parsing=20vs.=20lokale=20Zeit?= =?UTF-8?q?=20in=20UTC+2).=20Neue=20L=C3=B6sung:=20das=20bereits=20korrekt?= =?UTF-8?q?=20arbeitende=20alldayLayout=20wird=20direkt=20als=20Quelle=20v?= =?UTF-8?q?erwendet.=20Items=20mit=20colEnd=20>=20colStart=20sind=20mehrt?= =?UTF-8?q?=C3=A4gig=20=E2=80=94=20die=20Spaltenindizes=20aus=20dem=20Layo?= =?UTF-8?q?ut=20ergeben=20den=20Tint-Bereich=20exakt.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/js/views/week.js | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/frontend/js/views/week.js b/frontend/js/views/week.js index d16efe4..bc440bc 100644 --- a/frontend/js/views/week.js +++ b/frontend/js/views/week.js @@ -20,15 +20,6 @@ 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) { @@ -58,6 +49,8 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC const ALLDAY_LANE_H = 22; const allDayAndMulti = [...allDayEvs, ...multiDayTimedEvs]; const alldayLayout = layoutWeekAllDay(allDayAndMulti, days); + // Items that span more than one column → used for column background tint + const multiDayLayoutItems = alldayLayout.filter(item => item.colEnd > item.colStart); const maxAlldayLane = alldayLayout.length ? alldayLayout.reduce((m, it) => Math.max(m, it.lane), 0) : -1; const alldayRowH = maxAlldayLane < 0 ? 28 : (maxAlldayLane + 1) * ALLDAY_LANE_H + 6; @@ -95,7 +88,7 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC ).join(''); // ── Day columns ─────────────────────────────────────── - const dayCols = days.map(day => { + const dayCols = days.map((day, dayIdx) => { const key = dayKey(day); const dayEvs = timedEvs.filter(ev => { const s = new Date(ev.start); @@ -130,8 +123,10 @@ export function renderWeek(container, currentDate, events, onSlotClick, onEventC `; }).join(''); - // Background tint for days covered by multi-day events (timed or all-day) - const dayTintEvs = tintEvs.filter(ev => spansDay(ev, day)); + // Background tint: reuse alldayLayout (proven correct) — colEnd > colStart = multi-day + const dayTintEvs = multiDayLayoutItems + .filter(item => dayIdx >= item.colStart && dayIdx <= item.colEnd) + .map(item => item.ev); const tintHtml = (() => { if (!dayTintEvs.length) return ''; const colors = dayTintEvs.map(ev => ev.color || ev.calendarColor || '#4285f4');