Skip to content

Session timestamps display in UTC instead of local time #9025

Closed

Description

@xshua06

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.

Activity

  1. github-actions commented on Jan 17, 2026

    @github-actions
    Contributor

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

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

  2. thdxr commented on Mar 25, 2026

    @thdxr
    Member

    To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions