From 65f6fdd04590a3ce9055495003e6b1412bb5dbe6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E8=B4=BA?= Date: Sun, 20 Sep 2026 18:02:46 +0800 Subject: [PATCH] fix(ssh): display SSH login logs in server timezone (#13869) The SSH log page formatted dates with the browser timezone, so logs looked shifted when the client timezone differed from the server. Format the timestamp with the offset returned by the API so the page matches auth.log, the terminal and the CSV export. Refs #13860. --- frontend/src/utils/date.ts | 9 +++++++++ frontend/src/views/host/ssh/log/log.vue | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/date.ts b/frontend/src/utils/date.ts index 103a8b49b..376ec118f 100644 --- a/frontend/src/utils/date.ts +++ b/frontend/src/utils/date.ts @@ -74,6 +74,15 @@ export function dateFormat(row: any, col: any, dataStr: any) { return `${String(y)}-${String(m)}-${String(d)} ${String(h)}:${String(minute)}:${String(second)}`; } +export function dateFormatServerTimezone(row: any, col: any, dataStr: any) { + const text = String(dataStr || ''); + const matched = /^(\d{4}-\d{2}-\d{2})T(\d{2}:\d{2}:\d{2})/.exec(text); + if (!matched) { + return text; + } + return `${matched[1]} ${matched[2]}`; +} + export function dateFormatSimple(dataStr: any) { const date = new Date(dataStr); const y = date.getFullYear(); diff --git a/frontend/src/views/host/ssh/log/log.vue b/frontend/src/views/host/ssh/log/log.vue index 0d64888b0..1f09cd174 100644 --- a/frontend/src/views/host/ssh/log/log.vue +++ b/frontend/src/views/host/ssh/log/log.vue @@ -51,7 +51,7 @@ @@ -94,7 +94,7 @@