fix(homepage): validate clock widget timezones - #1374
Merged
ZacharyZcR merged 1 commit intoAug 31, 2026
Conversation
An invalid timezone in a clock widget's config reached toLocaleTimeString unchecked, throwing RangeError during render and taking the homepage canvas down with it. The edit dialog accepted any string, so "America/New York" - a space where IANA wants an underscore - was easy to save, and the homepage stayed broken on every later load because the value is reloaded from the database. The edit dialog now flags an unusable zone the way FolderMetadataDialog flags a duplicate folder name: inline message, aria-invalid, and a disabled Save. Whitespace is normalized to underscores on save, so the space spelling is stored as America/New_York rather than rejected. ClockWidget falls back to local time for any config already holding an invalid zone. Related to Termix-SSH/Support#1238
ZacharyZcR
approved these changes
Aug 31, 2026
ZacharyZcR
left a comment
Member
There was a problem hiding this comment.
Reviewed the timezone validation, persisted-config fallback, and test coverage. The focused tests, full frontend suite, type-check, lint, formatting, and diff checks all pass. No blocking changes requested.
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.
Overview
RangeErrorduring render and took the homepage canvas down with itClockWidgetnow falls back to local time for configs already stored with an unusable zoneChanges Made
src/ui/features/homepage/clock-timezone.ts(new) —normalizeTimezone,isValidTimezoneandvalidateClockTimezone, shared by the widget and the dialog so the check lives in one place.ClockEditForm.tsx— flags an unusable zone the same wayFolderMetadataDialogflags a duplicate folder name:aria-invalid,border-destructive, and an inlinetext-destructivemessage.WidgetEditDialog.tsx— onetypeId === "clock"branch: Save is disabled while the zone is unusable,handleSaveguards again, and the normalized zone is what gets stored, soAmerica/New Yorkis saved asAmerica/New_Yorkinstead of being rejected. No other widget form is touched.ClockWidget.tsx— validates before formatting, falling back to local time (and hiding the zone label) for configs saved before this change, so an existing broken homepage recovers on its own.en.json— one new key,homepage.invalidTimezone.ClockTimezone.test.tsxandWidgetEditDialogClock.test.tsx, 38 assertions covering the widget fallback, the normalizer, the inline error, and Save being blocked and then re-enabled.Related Issues
Screenshots / Demos
Invalid zone: the field is flagged and Save is disabled, so it can no longer be stored.
A space instead of an underscore is accepted and normalized on save — no error, Save enabled.
Saved result — the widget renders the zone as
America/New_York:Before this change, that same config threw during render and took the canvas down with it:
Checklist