feat: add 12h/24h/auto time format setting#427
feat: add 12h/24h/auto time format setting#427HDash wants to merge 4 commits intorobinebers:mainfrom
Conversation
Adds TimeFormatMode ("auto" | "12h" | "24h") with load/save helpers,
default "auto" so existing locale-based behavior is preserved.
Replaces the module-level RESET_TIME_FORMATTER with a cached getTimeFormatter(mode). formatResetAbsoluteLabel and formatResetTooltipText accept an optional timeFormat param (default "auto") so existing call sites stay valid.
Adds a Time Format section to Settings (below Reset Timers) with Auto / 12-hour / 24-hour radios and live previews. Default "Auto" follows OS locale; explicit choices override. The chosen mode flows from the preferences store through app-content -> overview/provider-detail -> provider-card to the reset-tooltip formatter, so reset times in cards and tooltips render in the user's preferred clock.
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable time format preference (Auto / 12-hour / 24-hour) and threads it through settings persistence and reset-time formatting so provider card reset labels/tooltips render using the selected clock format.
Changes:
- Introduces
TimeFormatMode+ persistence helpers (loadTimeFormatMode/saveTimeFormatMode) and app preference store wiring. - Adds a new “Time Format” section to Settings with live previews and update actions.
- Threads
timeFormatModethrough app content → pages → provider cards → reset label/tooltip formatter, with new/updated tests.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/stores/app-preferences-store.ts | Adds timeFormatMode state + setter to the app preferences store. |
| src/pages/settings.tsx | Renders new Time Format setting UI and uses the shared formatter for previews. |
| src/pages/settings.test.tsx | Adds coverage for the new Settings “Time Format” section and click behavior. |
| src/pages/provider-detail.tsx | Passes timeFormatMode through to ProviderCard (defaulting to auto). |
| src/pages/overview.tsx | Passes timeFormatMode through to ProviderCard (defaulting to auto). |
| src/lib/settings.ts | Defines TimeFormatMode, option list, and persistence load/save functions. |
| src/lib/settings.test.ts | Adds persistence tests for loading/saving/validating time format mode. |
| src/lib/reset-tooltip.ts | Adds cached getTimeFormatter and threads time format into absolute reset labels/tooltips. |
| src/lib/reset-tooltip.test.ts | Adds tests for 12h/24h formatting and timeFormat threading. |
| src/hooks/app/use-settings-display-actions.ts | Persists/tracks time format changes via new action handler. |
| src/hooks/app/use-settings-display-actions.test.ts | Updates tests to include the new time format action behavior. |
| src/hooks/app/use-settings-bootstrap.ts | Bootstraps timeFormatMode from the settings store at startup. |
| src/hooks/app/use-settings-bootstrap.test.ts | Updates bootstrap tests to mock/load the new setting. |
| src/components/provider-card.tsx | Threads timeFormatMode into reset label + tooltip formatting. |
| src/components/app/app-content.tsx | Reads timeFormatMode from store and passes to pages/settings. |
| src/App.tsx | Wires bootstrap + settings actions to setTimeFormatMode / handler prop. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Rename TIME_FORMAT_KEY value "timeFormat" -> "timeFormatMode" to match the themeMode/displayMode/resetTimerDisplayMode pattern. - Make the new reset-tooltip tests locale-independent by deriving expected strings via getTimeFormatter(mode) instead of hardcoded "AM/PM" / "14:05" literals. - Add the missing setMenubarIconStyle stub to the three useSettingsDisplayActions test sites so test inputs match the hook signature.
|
Thanks @copilot — addressed in 456d8d2:
Local: |
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
validatedev
left a comment
There was a problem hiding this comment.
No issues. Looks good to me, and feels like a good improvement. Thanks!
Description
Adds a Time Format setting (Auto / 12-hour / 24-hour) to Settings, below Reset Timers. Default Auto preserves existing locale-driven behavior; explicit choices override.
The mode flows from the preferences store through the reset-tooltip formatter, so reset times in provider cards and tooltips render in the user's preferred clock.
Related Issue
Closes #426
Type of Change
Testing
npm run build(tsc) — cleannpm test— 60 files, 1087 tests passingtauri dev(see screenshots)Screenshots
Before — current
main, no time format option:After — new Time Format section in Settings:
After — provider card rendering reset time in the chosen format:
Checklist
mainbranch