Session timestamps display in UTC instead of local time #6563

Open
opened 2026-02-16 18:04:36 -05:00 by yindo · 1 comment
Owner

Originally created by @xshua06 on GitHub (Jan 17, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

OpenCode session titles use UTC time format instead of the user's local time.

Environment

  • OS: macOS 13 (CST, UTC+8)
  • OpenCode Version: 1.1.25
  • Local time: 12:20 (CST)
  • Displayed time: 02:53 (UTC)

Steps to Reproduce

  1. Create a new session at local time 12:20
  2. View the session title
  3. Title shows UTC time (e.g., "New session - 2026-01-16T07:04:45.519Z")

Expected Behavior

Session titles should display the user's local time, not UTC time.

Actual Behavior

Session titles use toISOString() which always returns UTC time (ending with Z), regardless of the TZ environment variable.

Attempted Solutions

  1. Set TZ=Asia/Shanghai environment variable - No effect
  2. Added alias opencode="TZ=Asia/Shanghai opencode" to shell config - No effect
  3. Reloaded shell config with source ~/.zshrc - No effect

Root Cause

From the stored session file:

{
  "title": "New session - 2026-01-16T07:04:45.519Z",
  "time": {
    "created": 1768547085519,
    "updated": 1768547085674
  }
}

The issue is in the OpenCode source code using new Date().toISOString(), which always returns UTC time and is not affected by the TZ environment variable.

Suggested Fix

When generating session titles, use local time format instead of ISO format, or:

  1. Use toLocaleString() method
  2. Use moment.js or date-fns for timezone-aware time formatting
  3. Add a configuration option for users to choose time display format

Additional Info

  • System timezone is correct: CST (China Standard Time)
  • System date command shows correct time
  • Node.js can display local time when properly configured, but OpenCode doesn't use localized time

Impact

All users in non-UTC timezones see incorrect timestamps, affecting user experience.

Originally created by @xshua06 on GitHub (Jan 17, 2026). Originally assigned to: @rekram1-node on GitHub. ## Description OpenCode session titles use UTC time format instead of the user's local time. ## Environment - **OS**: macOS 13 (CST, UTC+8) - **OpenCode Version**: 1.1.25 - **Local time**: 12:20 (CST) - **Displayed time**: 02:53 (UTC) ## Steps to Reproduce 1. Create a new session at local time 12:20 2. View the session title 3. Title shows UTC time (e.g., "New session - 2026-01-16T07:04:45.519Z") ## Expected Behavior Session titles should display the user's local time, not UTC time. ## Actual Behavior Session titles use `toISOString()` which **always returns UTC time** (ending with `Z`), regardless of the `TZ` environment variable. ## Attempted Solutions 1. Set `TZ=Asia/Shanghai` environment variable - No effect 2. Added `alias opencode="TZ=Asia/Shanghai opencode"` to shell config - No effect 3. Reloaded shell config with `source ~/.zshrc` - No effect ## Root Cause From the stored session file: ```json { "title": "New session - 2026-01-16T07:04:45.519Z", "time": { "created": 1768547085519, "updated": 1768547085674 } } ``` The issue is in the OpenCode source code using `new Date().toISOString()`, which **always returns UTC time** and is not affected by the `TZ` environment variable. ## Suggested Fix When generating session titles, use local time format instead of ISO format, or: 1. Use `toLocaleString()` method 2. Use moment.js or date-fns for timezone-aware time formatting 3. Add a configuration option for users to choose time display format ## Additional Info - System timezone is correct: CST (China Standard Time) - System `date` command shows correct time - Node.js can display local time when properly configured, but OpenCode doesn't use localized time ## Impact All users in non-UTC timezones see incorrect timestamps, affecting user experience.
Author
Owner

@github-actions[bot] commented on GitHub (Jan 17, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #7208: Add option to use 24-hour time format in session view (relates to time display formatting in sessions)
  • #7262: Session titles stopped auto-generating - mentions the same 'New session - [timestamp]' pattern
  • #1574: Timestamps always show the time of the last human message (timestamp accuracy issue)
  • #8634: Add timestamp next to messages in chat (related timestamp display feature)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 17, 2026): This issue might be a duplicate of existing issues. Please check: - #7208: Add option to use 24-hour time format in session view (relates to time display formatting in sessions) - #7262: Session titles stopped auto-generating - mentions the same 'New session - [timestamp]' pattern - #1574: Timestamps always show the time of the last human message (timestamp accuracy issue) - #8634: Add timestamp next to messages in chat (related timestamp display feature) Feel free to ignore if none of these address your specific case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#6563