From 6bee3a7d31fe4d7adb78bb236cf144e2d669f594 Mon Sep 17 00:00:00 2001 From: kami Date: Mon, 22 Jun 2026 10:14:51 +0000 Subject: [PATCH] fix(tui-go): render event/activity times in local time, not UTC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit formatTime forced .UTC(), so every event-log timestamp and the welcome "recent" times read hours off the operator's wall clock — and inconsistent with the local date just added to the session list. time.UnixMilli is already local, so the explicit .UTC() was the bug; drop it. No test asserts a clock string (the render matrix only checks event type/detail), so this is display-only. Co-Authored-By: Claude Opus 4.8 --- apps/tui-go/internal/app/render_matrix_test.go | 6 +++--- apps/tui-go/internal/app/server.go | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/apps/tui-go/internal/app/render_matrix_test.go b/apps/tui-go/internal/app/render_matrix_test.go index 5b17ed7d..9bb00896 100644 --- a/apps/tui-go/internal/app/render_matrix_test.go +++ b/apps/tui-go/internal/app/render_matrix_test.go @@ -45,9 +45,9 @@ const ( surfaceStatusBar // top status bar (renderStatus) ) -// fixedNow is a deterministic timestamp used for every event carrying OccurredAt, so -// formatTime output is stable across runs/machines. (Events that fall back to -// nowMillis() are asserted only on their type/detail text, never the clock.) +// fixedNow is a deterministic timestamp used for every event carrying OccurredAt. The +// matrix asserts only event type/detail text, never the rendered clock — formatTime is +// local (machine-TZ dependent), so the time string is intentionally not part of any golden. const fixedNow int64 = 1_700_000_000_000 // matrixCase is one event/entry kind in the matrix. diff --git a/apps/tui-go/internal/app/server.go b/apps/tui-go/internal/app/server.go index 7be87790..7d76d259 100644 --- a/apps/tui-go/internal/app/server.go +++ b/apps/tui-go/internal/app/server.go @@ -22,8 +22,11 @@ func containsFold(haystack, needle string) bool { return strings.Contains(strings.ToLower(haystack), strings.ToLower(needle)) } +// formatTime renders an event/activity instant as a local wall-clock time, matching the +// operator's clock (and the local date shown in the session list). It was previously forced +// to UTC, so every event timestamp read hours off the user's actual time. func formatTime(epochMillis int64) string { - return time.UnixMilli(epochMillis).UTC().Format("15:04:05") + return time.UnixMilli(epochMillis).Format("15:04:05") } // inferCategory maps an event type string to a display category, matching the