From e83908d1ac297c726de8475f62e26a41fcf857a8 Mon Sep 17 00:00:00 2001 From: wanghe-fit2cloud Date: Sun, 20 Sep 2026 14:55:45 +0800 Subject: [PATCH] fix(ssh): display SSH login logs in server timezone 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 103a8b49b127..376ec118f379 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 0d64888b016e..1f09cd174f7f 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 @@