diff --git a/frontend/src/tools/bestellungen.jsx b/frontend/src/tools/bestellungen.jsx index 5c32ec3..5d6bd6d 100644 --- a/frontend/src/tools/bestellungen.jsx +++ b/frontend/src/tools/bestellungen.jsx @@ -45,7 +45,11 @@ function BestellungDetail({ id, toast, onBack }) { const [pickerSearch,setPickerSearch]= useState(''); const [editMode, setEditMode] = useState(false); const [form, setForm] = useState({ name:'', bemerkung:'', custom_price:'', status:'warteliste' }); - const today = () => new Date().toISOString().slice(0,10); + const today = () => { + const d = new Date(); + const y = d.getFullYear(), m = String(d.getMonth()+1).padStart(2,'0'), day = String(d.getDate()).padStart(2,'0'); + return `${y}-${m}-${day}`; + }; const [bezahltDate, setBezahltDate] = useState(today()); const [abgeholtDate, setAbgeholtDate] = useState(today()); const [showBezahltPicker, setShowBezahltPicker] = useState(false); diff --git a/frontend/src/tools/statistik.jsx b/frontend/src/tools/statistik.jsx index c8e2370..5d6358c 100644 --- a/frontend/src/tools/statistik.jsx +++ b/frontend/src/tools/statistik.jsx @@ -22,6 +22,13 @@ const CATS = ['Filament','Zubehör','Ersatzteile','Werkzeug','Sonstiges']; const CAT_COLORS = { Filament:'#4ecdc4', Zubehör:'#ffe66d', Ersatzteile:'#ff6b9d', Werkzeug:'#60a5fa', Sonstiges:'#c084fc' }; const fmt = v => `${(v||0).toFixed(2)} €`; +// Lokales Datum als YYYY-MM-DD (kein UTC-Bug wie bei toISOString) +function todayLocal() { + const d = new Date(); + const y = d.getFullYear(), m = String(d.getMonth()+1).padStart(2,'0'), day = String(d.getDate()).padStart(2,'0'); + return `${y}-${m}-${day}`; +} + const fmtMonth = m => { if (!m) return ''; if (/^\d{4}-\d{2}$/.test(m)) { @@ -192,12 +199,12 @@ function OrdersInPeriod({ fromDate, toDate }) { export default function Statistik({ mobile }) { const [fromDate, setFromDate] = useState(''); - const [toDate, setToDate] = useState(new Date().toISOString().slice(0,10)); + const [toDate, setToDate] = useState(todayLocal()); const [data, setData] = useState(null); const [loading,setLoading] = useState(false); const [tab, setTab] = useState('overview'); - const [expForm,setExpForm] = useState({ date: new Date().toISOString().slice(0,10), category:'Filament', description:'', amount:'' }); + const [expForm,setExpForm] = useState({ date: todayLocal(), category:'Filament', description:'', amount:'' }); const [saving, setSaving] = useState(false); function load() { @@ -251,7 +258,7 @@ export default function Statistik({ mobile }) { borderRadius:8,padding:'5px 10px',color:'#fff',fontFamily:'monospace',fontSize:11,cursor:'pointer'}}/> {fromDate && ( -