Skip to content

A Simple and Universal Swarm Intelligence Engine, Predicting Anything. 简洁通用的群体智能引擎,预测万物

fix(frontend): show local date in history cards (not UTC)

Osamaali313e6a502121b54
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) || ''
}