fix: Kalender-Abfragefenster skaliert mit der eingestellten Tage-Ansicht
Some checks are pending
Playwright Tests / test (push) Waiting to run
Test and SonarQube / quality (push) Waiting to run

fetchCalendarEvents holte serverseitig immer nur currentWeekStart -7/+14 Tage, egal
wie breit die Ansicht (bis zu 31 Tage) tatsächlich war. Spalten jenseits von Tag 14
blieben leer, der "all day"-Zaehler zaehlte nur die geladenen Termine. timeMax
skaliert jetzt mit viewDays (max(14, viewDays + 7) Tage vorwaerts), 7-Tage-Standard
unveraendert.

v1.129.2

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
mARTin-B78 2026-09-14 23:27:05 +02:00
parent d6de7e8f06
commit e579fc0be8
3 changed files with 31 additions and 12 deletions

View File

@ -2,6 +2,22 @@
All notable changes to this project are documented in this file. All notable changes to this project are documented in this file.
## [1.129.2] - 2026-09-14
### Fixed
- **Kalendertermine und der "All day"-Zähler fehlten in weiten Ansichten** (Tage-Auswahl
> 14, z.B. 21 oder 31 Tage): `fetchCalendarEvents` fragte serverseitig immer nur ein
festes Fenster von `currentWeekStart - 7` bis `currentWeekStart + 14` Tage ab, egal wie
breit die Ansicht tatsächlich eingestellt war. Spalten jenseits von Tag 14 blieben
dadurch leer, und der Zähler neben "all day" zählte nur die tatsächlich geladenen
Termine mit — beides sah nach fehlenden Daten aus, obwohl die Termine existierten.
`timeMax` skaliert jetzt mit `viewDays` (`currentWeekStart + max(14, viewDays + 7)`
Tage), der Standard-7-Tage-Fall bleibt unverändert (weiterhin 14 Tage Vorlauf).
Verifiziert: Typecheck und Produktions-Build grün (Scratchpad-Klon), 118 Unit-Tests
grün, Datumsrechnung für viewDays 7/14/21/31 per Skript gegengeprüft — das neue Fenster
deckt in jedem Fall den letzten sichtbaren Tag plus Puffer ab.
## [1.129.1] - 2026-09-14 ## [1.129.1] - 2026-09-14
### Fixed ### Fixed

View File

@ -1,6 +1,6 @@
{ {
"name": "my-weekly-todo-list", "name": "my-weekly-todo-list",
"version": "1.129.1", "version": "1.129.2",
"description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view", "description": "A web-based weekly task management application that organizes to-dos and calendar events in a single, intuitive weekly view",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -1397,16 +1397,22 @@ export default function WeeklyView() {
startSync(); startSync();
setIsFetchingCalendar(true); setIsFetchingCalendar(true);
try { try {
// timeMax must cover the whole configured view (up to MAX_VIEW_DAYS=31), not just
// the default 7-day week — otherwise columns past day 14 silently show no events
// and the all-day count badge undercounts (it only tallies fetched events).
const forwardDays = Math.max(14, viewDays + 7);
const timeMin = new Date(
currentWeekStart.getTime() - 7 * 24 * 60 * 60 * 1000,
).toISOString();
const timeMax = new Date(
currentWeekStart.getTime() + forwardDays * 24 * 60 * 60 * 1000,
).toISOString();
const response = await fetch("/api/calendar/sync", { const response = await fetch("/api/calendar/sync", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({
timeMin: new Date( timeMin,
currentWeekStart.getTime() - 7 * 24 * 60 * 60 * 1000, timeMax,
).toISOString(),
timeMax: new Date(
currentWeekStart.getTime() + 14 * 24 * 60 * 60 * 1000,
).toISOString(),
forceRefresh, forceRefresh,
...(connectionId ? { connectionId } : {}), ...(connectionId ? { connectionId } : {}),
}), }),
@ -1425,10 +1431,7 @@ export default function WeeklyView() {
fetch("/api/calendar/sync", { fetch("/api/calendar/sync", {
method: "POST", method: "POST",
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
body: JSON.stringify({ body: JSON.stringify({ timeMin, timeMax }),
timeMin: new Date(currentWeekStart.getTime() - 7 * 24 * 60 * 60 * 1000).toISOString(),
timeMax: new Date(currentWeekStart.getTime() + 14 * 24 * 60 * 60 * 1000).toISOString(),
}),
}).then(r => r.json()).then(d => { }).then(r => r.json()).then(d => {
if (d.events) setRawCalendarEvents(d.events); if (d.events) setRawCalendarEvents(d.events);
}).catch(() => {}); }).catch(() => {});
@ -1447,7 +1450,7 @@ export default function WeeklyView() {
setIsFetchingCalendar(false); setIsFetchingCalendar(false);
endSync(); endSync();
} }
}, [currentWeekStart, startSync, endSync]); }, [currentWeekStart, viewDays, startSync, endSync]);
// Weather fetch // Weather fetch
const fetchWeather = useCallback(async () => { const fetchWeather = useCallback(async () => {