fix: period tracker day count off by one due to timezone mismatch

ongoingDay compared today (local time with hours) against startDate
parsed as UTC midnight, causing Math.floor to undershoot by 1 day.
Use todayMidnight and parseLocal to normalize both to local midnight.
This commit is contained in:
2026-04-08 11:28:00 +02:00
parent a854f5141a
commit af5e67a385

View File

@@ -246,8 +246,8 @@
// Days into current period
const ongoingDay = $derived.by(() => {
if (!ongoing) return 0;
const start = new Date(ongoing.startDate);
return Math.floor((today.getTime() - start.getTime()) / 86400000) + 1;
const start = parseLocal(ongoing.startDate);
return Math.floor((todayMidnight - start) / 86400000) + 1;
});
// Calendar data