feat(tz): timezone selector and persistent preference - #520
Draft
Gudsfile wants to merge 2 commits into
Draft
Conversation
|
Gudsfile
force-pushed
the
feat/timezone-selector
branch
from
June 15, 2026 21:06
b9fb297 to
0f70392
Compare
Gudsfile
marked this pull request as draft
June 15, 2026 21:13
Owner
Author
|
I'm not sure which direction to take with this feature. I have my doubts about the outcome. |
- 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
force-pushed
the
feat/timezone-selector
branch
from
July 24, 2026 21:06
16f4261 to
fb83b88
Compare
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.
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().timeZoneat 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.tsprovides a sharedgetStoredTimezone()helper that reads fromlocalStoragewith anIntlfallback, so data reloads always respect the saved preference.useTimezone/TimezoneContextmirror theuseThemepattern: selecting a new timezone saves it tolocalStorage, recreates the DuckDBmusic_streamsview viaprecomputeDerivedTables(conn, tz), and rebuilds all derived tables immediately.TimezoneSelectorrenders a native<select>populated fromIntl.supportedValuesOf('timeZone').SimpleViewdisplays 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 ZONEencoding 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