fix(tui-go): render event/activity times in local time, not UTC
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 <noreply@anthropic.com>
This commit is contained in:
@@ -45,9 +45,9 @@ const (
|
|||||||
surfaceStatusBar // top status bar (renderStatus)
|
surfaceStatusBar // top status bar (renderStatus)
|
||||||
)
|
)
|
||||||
|
|
||||||
// fixedNow is a deterministic timestamp used for every event carrying OccurredAt, so
|
// fixedNow is a deterministic timestamp used for every event carrying OccurredAt. The
|
||||||
// formatTime output is stable across runs/machines. (Events that fall back to
|
// matrix asserts only event type/detail text, never the rendered clock — formatTime is
|
||||||
// nowMillis() are asserted only on their type/detail text, never the clock.)
|
// local (machine-TZ dependent), so the time string is intentionally not part of any golden.
|
||||||
const fixedNow int64 = 1_700_000_000_000
|
const fixedNow int64 = 1_700_000_000_000
|
||||||
|
|
||||||
// matrixCase is one event/entry kind in the matrix.
|
// matrixCase is one event/entry kind in the matrix.
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ func containsFold(haystack, needle string) bool {
|
|||||||
return strings.Contains(strings.ToLower(haystack), strings.ToLower(needle))
|
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 {
|
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
|
// inferCategory maps an event type string to a display category, matching the
|
||||||
|
|||||||
Reference in New Issue
Block a user