#14709: fix: display local timezone in console logs
stale
size: XS
Cluster:
Timezone Support Enhancements
### Description
Fixes #14699
This PR addresses the issue where console logs were hardcoded to UTC time using `toISOString()`. It updates the formatting to respect the user's local system timezone.
### Changes
- Updated `formatConsoleTimestamp` in `src/logging/console.ts`.
- Uses `toLocaleTimeString` with `en-GB` locale to ensure a consistent 24-hour format (HH:mm:ss) across different environments.
- Adjusted standard style to reflect the local timezone offset.
### Test Configuration
- System Timezone: Asia/Shanghai (UTC+8)
- Result: Logs now correctly match the system clock instead of being 8 hours behind.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This change updates `formatConsoleTimestamp()` in `src/logging/console.ts` so console-captured output uses local time instead of `toISOString()`’s UTC.
Main concern is the new “compact/json” timestamp prefix format: it’s now an ISO-like string without any timezone designator, which is ambiguous and breaks an existing test expectation. Also, other console logging paths (notably `src/logging/subsystem.ts`’s `formatConsoleLine()` and JSON console output) still use `toISOString()`, so many console timestamps will remain UTC despite the PR’s stated intent.
<h3>Confidence Score: 3/5</h3>
- This PR is moderately safe to merge after fixing timestamp format consistency and covering remaining UTC console paths.
- The change is localized, but it introduces an ambiguous ISO-like timestamp (no timezone designator) and appears to leave other console timestamp codepaths still emitting UTC, conflicting with the PR’s stated goal and breaking existing test expectations.
- src/logging/console.ts; src/logging/subsystem.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#19611: fix: use local timezone in log file and console timestamps
by tag-assistant · 2026-02-18
88.2%
#7919: feat: implement timezone support for console timestamps and add ver...
by southpy · 2026-02-03
85.7%
#21859: fix(logs): respect TZ env var for timestamp display, fix Windows ti...
by hydro13 · 2026-02-20
85.3%
#12358: fix: Sessions format timestamps in sessions_history using userTimezone
by xialonglee · 2026-02-09
78.9%
#15784: fix: timestamp parsing should convert seconds to milliseconds
by murasame-desu-ai · 2026-02-13
77.3%
#4901: Show timezone abbreviation in system prompt
by dpalfox · 2026-01-30
75.8%
#11305: fix(logging): remove redundant subsystem prefix from log output
by janckerchen · 2026-02-07
74.5%
#15754: fix: handle Unix timestamps in seconds in parseAbsoluteTimeMs
by MisterGuy420 · 2026-02-13
74.5%
#15875: fix(cron): normalize seconds to milliseconds in timestamps
by Shuai-DaiDai · 2026-02-14
73.6%
#10836: feat(session_status): include ISO-8601 and Unix timestamps for sche...
by jeanlucthumm · 2026-02-07
73.4%