You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: session timestamps and log filenames use UTC (toISOString()) instead of local time #30347
Session titles and log filenames use
ew Date().toISOString(), which always returns UTC time. On systems with non-UTC timezones (e.g. UTC+07:00), timestamps are displayed 7 hours off from local time, causing confusion when users try to identify sessions or correlate logs with local events.
Steps to reproduce
Open opencode TUI (v1.15.13) on Windows with timezone UTC+07:00 (SE Asia Standard Time)
Start a new session — title shows \New session - 2026-06-01T17:00:00.000Z\ instead of local \2026-06-02T00:00:00\
Enable /timestamps\ — message timestamps also display in UTC
Check log files in ~/.local/share/opencode/logs/\ — filenames use UTC timestamps
Expected behavior
Session titles, message timestamps, and log filenames should reflect the system's local timezone, not UTC.
Actual behavior
All timestamps are hardcoded to UTC via
ew Date().toISOString().
Root cause locations
Two source files use \ oISOString():
*\packages/opencode/src/session/session.ts* — session title generation
*\packages/opencode/src/util/log.ts* — log filenames and log entry timestamps
\ oISOString()\ is defined by ECMAScript to always return UTC (ending in \Z), ignoring the system \TZ\ environment variable.
Proposed fix
Replace \ oISOString()\ with a local-time-aware formatter:
\\ ypescript
function toISOLocal(d: Date): string {
const z = (n: number) => String(n).padStart(2, '0');
const off = d.getTimezoneOffset();
const sign = off > 0 ? '-' : '+';
const absOff = Math.abs(off);
return \--\T::\:\;
}
\\
Or alternatively, use \Intl.DateTimeFormat\ or a library like \date-fns/\dayjs\ for more robust formatting.
Activity
github-actions commentedon Jun 2, 2026
This issue might be a duplicate of existing issues. Please check:
If your issue is distinct from these, please clarify what is different. Otherwise, consider adding your input to one of the existing issues.
v4ever1luv commentedon Jun 2, 2026
This issue is distinct from #22781 and #9025 in that it covers 3 areas, not just session titles:
I'm working on a PR that addresses all 3 with a unified local-time formatter. Will link it here shortly.
v4ever1luv commentedon Jun 2, 2026
Created PR #30350 that fixes this issue by replacing toISOString() with local-time formatting in session.ts, log.ts, and trace.ts.