fix(ai-activity): render timestamps in local time + add display timezone setting#251
Merged
Merged
Conversation
Activity log timestamps (events table, sessions list, detail modal) and the CSV / JSON / notebook exports rendered the raw UTC value from the backend (chrono::Utc::now().to_rfc3339()), so users saw UTC instead of their local time. Convert them to the OS local timezone on display and on export.
Add a Timezone selector under Settings → Localization: a searchable list of IANA zones with current UTC-offset labels, defaulting to "auto" (OS timezone). The selected zone drives UI timestamps (activity log, query history, favorites) and backend CSV / JSON / notebook exports (via chrono-tz, reading the persisted display_timezone from config). Query-history date grouping now classifies the today/yesterday/older boundaries in the selected zone so the group headers and the per-row times stay consistent.
| exportData: AiNotebookExport, | ||
| ): string { | ||
| const dateOnly = exportData.createdAt.slice(0, 10); | ||
| const dateOnly = formatLocalTimestamp(exportData.createdAt).slice(0, 10); |
There was a problem hiding this comment.
WARNING: Export filename uses OS timezone instead of display timezone
defaultExportFilename calls formatLocalTimestamp(exportData.createdAt) without passing the user's configured displayTimezone. This means the date portion of the export filename is derived from the OS local timezone rather than the display timezone selected in settings. The rest of the PR correctly localizes timestamps and exports to the chosen timezone, so the filename should do the same to stay consistent. Consider adding a timeZone parameter to defaultExportFilename and passing settings.displayTimezone from the caller (AiActivitySessionsTab.tsx).
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental Changes Reviewed
Previous Issues
Files Reviewed (6 files)
Reviewed by kimi-k2.6 · 822,099 tokens |
defaultExportFilename derived the date from the OS timezone; thread the configured display timezone through so the export filename matches the rest of the localized timestamps and exports.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Changes
Backend (
src-tauri)ai_activity::to_local_rfc3339(ts, tz)— UTC → local/IANA (viachrono-tz); falls back to OS-local forNone/auto/unknown zones.display_timezonefromconfig.json.AppConfig.display_timezone+save_configpersistence.Frontend (
src)formatLocalTimestamp/formatLocalTime/formatHistoryTimetake an optionaltimeZone(Intl-based);groupByDateclassifies day boundaries in that zone.LocalizationTabtimezone picker;SettingsContext.displayTimezone(default "auto").Commits
fix(ai-activity): render activity log timestamps in local time— the bug fix on its own (OS-local), builds/tests green independently.feat(settings): add configurable display timezone— makes the zone user-selectable on top.Test plan
cargo test --lib— 579 passed (incl.to_local_rfc3339, notebook header zone, config round-trip)vitest tests/utils/{aiActivity,dateGroups}.test.ts— 65 passed (incl. timezone day-boundary cases)tsc --noEmitcleanCloses #249
Closes #250