Repository navigation
feat(settings): editable timezone override independent of country default - #432
Merged
Merged
Conversation
…y default (#389) Replace the read-only timezone field with a native-Intl IANA selector in Settings and Setup, and validate the timezone on setup/initialize. Country changes now re-suggest the default timezone only when the tenant has not explicitly customized it.
…after timezone-override change
Contributor
Greptile SummaryThe PR adds editable, offline IANA timezone selection to Settings and first-run Setup while preserving country-based defaults and explicit overrides.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains; the previously reported completed-setup guard issue is fixed by checking setup state before payload validation, with regression coverage for malformed timezone input.
|
| Filename | Overview |
|---|---|
| main/routes/auth.ts | The completed-setup guard now precedes timezone validation, and the transaction retains its defensive user-count check. |
| main/routes/settings.ts | Business-settings updates validate timezone values before persistence. |
| main/countries.ts | Adds native offline IANA timezone validation and listing helpers. |
| frontend/src/components/TimeZoneSelect.tsx | Adds the shared searchable timezone selector used by Settings and Setup. |
| frontend/src/app/(dashboard)/settings/page.tsx | Makes timezone editable independently of country while retaining country-default suggestion behavior. |
| frontend/src/app/setup/page.tsx | Allows owners to select a timezone before initialization without silently replacing explicit choices. |
| tests/first-run-setup.test.ts | Covers setup timezone validation, persistence, and completed-setup guard precedence. |
| tests/issue-389-timezone-override.test.ts | Covers business-settings timezone persistence and invalid-value rejection. |
Reviews (2): Last reviewed commit: "fix(auth): keep completed setup returnin..." | Re-trigger Greptile
The timezone validation added for the tenant timezone override ran before the completed-setup guard, so a request with an invalid timezone against an already-initialized install returned 400 instead of the expected 403. Move the user-count guard ahead of all payload validation and add a regression test asserting a disabled setup stays 403 even for malformed payloads.
This was referenced Aug 20, 2026
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.
Intent
Allow FloCafe tenants to override their store timezone independently of the country profile default (issue #389, epic #388): make the Settings timezone field an editable, searchable IANA selector populated from native Intl.supportedValuesOf('timeZone'); add a Setup timezone selector pre-filled with the selected country default so owners can choose a different valid timezone before initialization; when switching country in either page, only re-suggest the new country default when the current value was still the previous country default (never silently overwrite an explicit choice); keep currency read-only and governed by the country profile; validate IANA timezone identifiers on PUT /api/settings/business and POST /api/auth/setup/initialize returning HTTP 400 for invalid values; preserve existing persisted timezone values for upgrades with no schema migration; and keep all timezone listing/validation fully offline using only native Intl APIs so date/time helpers keep rendering in the saved tenant timezone.
What Changed
TimeZoneSelectcomponent) populated fromIntl.supportedValuesOf('timeZone'), and added a timezone selector in the Setup wizard pre-filled with the selected country's defaultPOST /api/auth/setup/initializeandPUT /api/settings/business(HTTP 400 for invalid values) using nativeIntl.DateTimeFormat, withlistTimeZones()andisValidTimeZone()utilities that keep all timezone listing and validation fully offlineRisk Assessment
✅ Low: Well-bounded feature addition with shared validation, consistent country-switch logic in both pages, correct backend validation on both routes, and no schema migration. The change is straightforward with clear intent and proper i18n coverage.
Testing
Ran the two targeted test suites covering the backend timezone override feature for both Settings and Setup routes. Both suites passed: issue-389 test verifies custom timezone round-trips through PUT/GET/SQLite and invalid values are rejected with 400; first-run-setup test verifies invalid timezone rejection at setup and custom timezone persistence. Also exercised listTimeZones() and isValidTimeZone() directly to confirm 418 IANA timezones are returned, legacy aliases like US/Eastern are accepted, and invalid/null/empty values are rejected.
Evidence: issue-389-timezone-override test output
Evidence: first-run-setup test output
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
npm run test:issue-389-timezone-override(custom timezone persists + invalid rejected)node tests/run-electron-node-test.cjs tests/first-run-setup.test.ts(invalid timezone rejected + custom timezone persisted at setup)npx ts-node --transpile-onlyvalidation of listTimeZones() and isValidTimeZone() against IANA timezone behavior✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.