Skip to content

fix(opencode): use local time for log timestamps and filenames#21331

Open
elonnzhang wants to merge 1 commit intoanomalyco:devfrom
elonnzhang:fix/log-local-datetime
Open

fix(opencode): use local time for log timestamps and filenames#21331
elonnzhang wants to merge 1 commit intoanomalyco:devfrom
elonnzhang:fix/log-local-datetime

Conversation

@elonnzhang
Copy link
Copy Markdown

@elonnzhang elonnzhang commented Apr 7, 2026

Issue for this PR

Closes #21330

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

log.ts used toISOString() in two places, which outputs UTC time. For users outside UTC, log filenames and log entry timestamps don't match their local time, making it hard to correlate logs with what they were doing.

This PR adds Locale.localDatetime() to locale.ts that formats local time as YYYY-MM-DDTHH:mm:ss using local time methods, then replaces both toISOString() calls in log.ts with it.

How did you verify your code works?

Ran opencode locally (UTC+8), confirmed log filename and timestamps inside the file now show local time instead of UTC.

Screenshots / recordings

N/A — not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Replace toISOString() (UTC) with Locale.localDatetime() (local time)
in log entry formatting and log filename generation.

Add Locale.localDatetime() utility to locale.ts.

Fixes anomalyco#21330
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(opencode): log timestamps use local datetime instead of UTC ISO string

1 participant