Skip to content

feat(tz): timezone selector and persistent preference - #520

Draft
Gudsfile wants to merge 2 commits into
mainfrom
feat/timezone-selector
Draft

feat(tz): timezone selector and persistent preference#520
Gudsfile wants to merge 2 commits into
mainfrom
feat/timezone-selector

Conversation

@Gudsfile

@Gudsfile Gudsfile commented Jun 11, 2026

Copy link
Copy Markdown
Owner

1️⃣ First

🔇 Problem

Timestamps are now stored and queried relative to the user's local timezone (introduced in #516), but there is no way to override this timezone from the UI. The active timezone is determined solely by Intl.DateTimeFormat().resolvedOptions().timeZone at data load time, with no persistence across sessions.

Refs #203

🎹 Proposal

A timezone selector is added next to the theme toggle in the top-right corner of the app.

  • timezoneStorage.ts provides a shared getStoredTimezone() helper that reads from localStorage with an Intl fallback, so data reloads always respect the saved preference.
  • useTimezone / TimezoneContext mirror the useTheme pattern: selecting a new timezone saves it to localStorage, recreates the DuckDB music_streams view via precomputeDerivedTables(conn, tz), and rebuilds all derived tables immediately.
  • TimezoneSelector renders a native <select> populated from Intl.supportedValuesOf('timeZone').
  • SimpleView displays an informative note below the chart grid: "Time-based charts use timezone: <tz>".

A settings panel grouping theme and timezone controls is tracked in #519.

🎶 Comments

PR 2/2 for #203. Depends on #516.

Important

Known limitation: Apple Music exports TIMESTAMP WITH TIME ZONE encoding the original local listening time. The current pipeline normalizes to UTC before storage, so events recorded in a different timezone appear at the home-timezone equivalent rather than the original local time. Tracked in #517.

🎤 Test

  1. Load the demo data for each available provider and verify all are ingested without error.
  2. Verify that time-based charts (heatmap, streams per month...) reflect the selected timezone.
  3. Change the timezone in the selector and confirm charts update immediately without reloading data.
  4. Reload the page and verify the selected timezone is restored.

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://Gudsfile.github.io/tracksy/pr-preview/pr-520/

Built to branch gh-pages at 2026-07-24 21:07 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@Gudsfile
Gudsfile force-pushed the feat/timezone-selector branch from b9fb297 to 0f70392 Compare June 15, 2026 21:06
@Gudsfile Gudsfile self-assigned this Jun 15, 2026
github-actions Bot pushed a commit that referenced this pull request Jun 15, 2026
@Gudsfile
Gudsfile marked this pull request as draft June 15, 2026 21:13
github-actions Bot pushed a commit that referenced this pull request Jun 15, 2026
@Gudsfile Gudsfile added enhancement New feature or request [ app ] Concerns the front-end labels Jun 15, 2026
@Gudsfile

Copy link
Copy Markdown
Owner Author

I'm not sure which direction to take with this feature. I have my doubts about the outcome.

Gudsfile added 2 commits July 24, 2026 23:04
- timezoneStorage.ts: shared key + getStoredTimezone() helper (localStorage with Intl fallback)
- useTimezone / TimezoneContext: hook + context mirroring useTheme pattern; on change, recreates the DuckDB view and derived tables via precomputeDerivedTables(conn, tz)
- precomputeDerivedTables: uses getStoredTimezone() as default so data reloads respect the saved preference
- TimezoneSelector: native <select> from Intl.supportedValuesOf placed next to ThemeToggle in App
- SimpleView: informative note "Time-based charts use timezone: <tz>"
@Gudsfile
Gudsfile force-pushed the feat/timezone-selector branch from 16f4261 to fb83b88 Compare July 24, 2026 21:06
github-actions Bot pushed a commit that referenced this pull request Jul 24, 2026
@Gudsfile Gudsfile added the ➡️ to maturate To be discussed or developed before it's ready label Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[ app ] Concerns the front-end enhancement New feature or request ➡️ to maturate To be discussed or developed before it's ready

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant