fix: fix timezone handling across backend and frontend (v0.3.1)

- Add tz.py with local_strftime/to_local helpers that read system.timezone
  from DB and convert UTC datetimes to venue local time before formatting
- Fix all strftime() calls in orders.py, reports.py, printer_service.py
  that were formatting UTC datetimes without timezone conversion
- Fix get_order endpoint returning raw dicts without Z suffix on datetimes,
  causing JS new Date() to treat timestamps as local instead of UTC
- Fix fmtDate() in tokens.js that stripped the T separator before parsing,
  breaking UTC-to-local conversion for all report date displays
- Make open/partially_paid table chips more visually distinct on dashboard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 19:18:46 +03:00
co-authored by Claude Sonnet 4.6
parent 5da378a0ae
commit 72b12ddd9c
7 changed files with 84 additions and 37 deletions
+2 -6
View File
@@ -94,13 +94,9 @@ export const fmtTime = (iso) => {
}
export const fmtDate = (iso) => {
if (!iso) return '—'
// Parse as local time by replacing the T separator so Date treats it as local
const d = new Date(String(iso).replace('T', ' '))
const d = new Date(iso)
if (isNaN(d)) return String(iso)
const day = String(d.getDate()).padStart(2, '0')
const month = String(d.getMonth() + 1).padStart(2, '0')
const year = d.getFullYear()
return `${day}/${month}/${year}`
return d.toLocaleDateString('en-GB', { day: '2-digit', month: '2-digit', year: 'numeric' })
}
// Format a raw YYYY-MM-DD string (from a date picker) as DD/MM/YYYY without any timezone conversion