fix(display): respect TZ env on every CLI/MCP timestamp render#205
Merged
Conversation
Closes #119. Storage stays in UTC (`DateTime<Utc>`) — that's the right canonical form for ordering and serialization. But every user-facing timestamp was also printed in UTC, even with `TZ=Asia/Bangkok` set, because the display sites called `dt.format(...)` directly on the UTC value. Add `icm_core::format_local(&dt, fmt)`. `chrono::Local` honours the `TZ` env var on Unix (libc) and the system locale on Windows, so a single conversion at each display boundary is enough. Replace every display-side formatter in `icm-cli` (stats, show, memoir/concept, transcript list/show/stats, recall hit timestamp) and in the `icm_stats` MCP tool. Cloud and web JSON outputs keep `to_rfc3339` (UTC, machine-readable) — that contract is unchanged. Smoke test on the patched binary: $ TZ=UTC icm stats | grep Oldest # 08:12 $ TZ=Asia/Bangkok icm stats | grep Oldest # 15:12 (+7) $ TZ=America/Los_Angeles icm stats | grep Oldest # 01:12 (-7) Two unit tests on the helper. The TZ-shift verification has to be done via the binary smoke test because `chrono::Local` reads the env once and Rust unit tests run in parallel — mutating TZ from inside a test is racy with sibling tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #119.
Storage stays in UTC (`DateTime`) — that's the right canonical form for ordering and serialization. But every user-facing timestamp was also printed in UTC, even with `TZ=Asia/Bangkok` set, because the display sites called `dt.format(...)` directly on the UTC value.
Fix
Smoke test on the release binary
```
$ TZ=UTC icm stats | grep Oldest # 2026-05-10 08:12
$ TZ=Asia/Bangkok icm stats | grep Oldest # 2026-05-10 15:12 (+7)
$ TZ=America/Los_Angeles icm stats | grep Oldest # 2026-05-10 01:12 (-7)
```
Test plan
The TZ-shift correctness is asserted via the binary smoke test rather than a unit test because `chrono::Local` reads the env var once and Rust tests run in parallel — mutating `TZ` from inside one test would be racy with siblings.
🤖 Generated with Claude Code