diff --git a/frontend/src/tools/statistik.jsx b/frontend/src/tools/statistik.jsx index 398d34e..cb6cf83 100644 --- a/frontend/src/tools/statistik.jsx +++ b/frontend/src/tools/statistik.jsx @@ -70,7 +70,12 @@ function periodRange(id, custom) { const now = new Date(); const pad = n => String(n).padStart(2,'0'); const iso = d => `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())}`; - if (id==='week') { const d=new Date(now); d.setDate(d.getDate()-6); return { from:iso(d), to:iso(now) }; } + if (id==='week') { + const d = new Date(now); + const day = d.getDay() || 7; // 1=Mo … 7=So + d.setDate(d.getDate() - (day - 1)); // zurück auf Montag + return { from:iso(d), to:iso(now) }; + } if (id==='month') { const d=new Date(now.getFullYear(),now.getMonth(),1); return { from:iso(d), to:iso(now) }; } if (id==='year') { return { from:`${now.getFullYear()}-01-01`, to:iso(now) }; } if (id==='custom' && custom) {