Describe the bug
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.
Related issues
Environment
- OpenCode version: v1.15.13
- Platform: Windows
- Timezone: UTC+07:00 (SE Asia Standard Time)
Describe the bug
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
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():
\ 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.
Related issues
Environment