From e6a502121b54f978a9d53d88f42981d3026b6c04 Mon Sep 17 00:00:00 2001 From: Osamaali313 Date: Thu, 9 Jul 2026 23:27:46 +0300 Subject: [PATCH] fix(frontend): show local date in history cards (not UTC) HistoryDatabase.vue formatDate() derived the day from UTC (new Date(dateStr).toISOString().slice(0, 10)) while the sibling formatTime() uses local hours/minutes. The backend sends naive-local timestamps (datetime.now().isoformat()), so for any non-UTC client the two disagree by up to a day -- e.g. for the project's UTC+8 audience a record created 00:00-08:00 local shows the previous day's date next to the current time. Derive the date from local components so it matches the time shown. --- frontend/src/components/HistoryDatabase.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/HistoryDatabase.vue b/frontend/src/components/HistoryDatabase.vue index d6c6e9a5..5bcad63e 100644 --- a/frontend/src/components/HistoryDatabase.vue +++ b/frontend/src/components/HistoryDatabase.vue @@ -312,7 +312,13 @@ const formatDate = (dateStr) => { if (!dateStr) return '' try { const date = new Date(dateStr) - return date.toISOString().slice(0, 10) + // Use local date components (like formatTime below) so the displayed day + // matches the displayed time. toISOString() converts to UTC and can show + // the wrong day for non-UTC clients near midnight. + const year = date.getFullYear() + const month = String(date.getMonth() + 1).padStart(2, '0') + const day = String(date.getDate()).padStart(2, '0') + return `${year}-${month}-${day}` } catch { return dateStr?.slice(0, 10) || '' }