Skip to content

fix(ai-activity): render timestamps in local time + add display timezone setting#251

Merged
debba merged 5 commits into
TabularisDB:mainfrom
ymadd:worktree-fix-ai-log-timezone
May 25, 2026
Merged

fix(ai-activity): render timestamps in local time + add display timezone setting#251
debba merged 5 commits into
TabularisDB:mainfrom
ymadd:worktree-fix-ai-log-timezone

Conversation

@ymadd
Copy link
Copy Markdown
Contributor

@ymadd ymadd commented May 25, 2026

Summary

  • Render AI activity log timestamps (events table, sessions, detail modal) in the user's timezone instead of raw UTC.
  • Localize CSV / JSON / notebook exports backend-side (chrono → local/IANA zone).
  • Add a configurable display timezone setting (Settings → Localization), an IANA-zone searchable picker with UTC-offset labels, defaulting to "Auto" (OS zone).
  • Query history / favorites date grouping and labels now respect the selected zone, with day-boundary classification computed in the same zone used for rendering.

Changes

Backend (src-tauri)

  • ai_activity::to_local_rfc3339(ts, tz) — UTC → local/IANA (via chrono-tz); falls back to OS-local for None/auto/unknown zones.
  • CSV/JSON/notebook exports read display_timezone from config.json.
  • AppConfig.display_timezone + save_config persistence.

Frontend (src)

  • formatLocalTimestamp / formatLocalTime / formatHistoryTime take an optional timeZone (Intl-based); groupByDate classifies day boundaries in that zone.
  • LocalizationTab timezone picker; SettingsContext.displayTimezone (default "auto").
  • i18n keys (en/ja).

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 --noEmit clean
  • Manual: pick a non-local zone, confirm activity log + exports reflect it

Closes #249
Closes #250

ymadd added 2 commits May 26, 2026 00:19
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.
Comment thread src/utils/aiActivity.ts Outdated
exportData: AiNotebookExport,
): string {
const dateOnly = exportData.createdAt.slice(0, 10);
const dateOnly = formatLocalTimestamp(exportData.createdAt).slice(0, 10);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

@kilo-code-bot
Copy link
Copy Markdown

kilo-code-bot Bot commented May 25, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental Changes Reviewed

  • src/components/layout/sidebar/QueryHistorySection.tsx — merge resolution clean; duplicate QueryHistoryEntry import correctly removed in follow-up commit.
  • src/contexts/QueryHistoryProvider.tsx — merge from main integrated cleanly.
  • src/utils/aiActivity.ts — previously reported WARNING (export filename timezone) remains resolved.

Previous Issues

File Line Issue Status
src/utils/aiActivity.ts N/A Export filename uses OS timezone instead of display timezone Resolved
Files Reviewed (6 files)
  • src/components/layout/sidebar/QueryHistorySection.tsx — merge resolution + import fix reviewed
  • src/contexts/QueryHistoryProvider.tsx — merge integration checked
  • src/utils/aiActivity.ts — re-verified previous issue is resolved
  • src/components/settings/ai-activity/AiActivitySessionsTab.tsx — no changes since previous review
  • tests/utils/aiActivity.test.ts — no changes since previous review

Reviewed by kimi-k2.6 · 822,099 tokens

ymadd and others added 3 commits May 26, 2026 01:24
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.
@debba debba merged commit 44899f3 into TabularisDB:main May 25, 2026
2 checks passed
@ymadd ymadd deleted the worktree-fix-ai-log-timezone branch May 26, 2026 08:24
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.

[Feat]: Add a display timezone setting (Settings → Localization) [Bug]: AI activity log timestamps are shown in UTC instead of local time

2 participants