fix: honor display time format and locale for all clock times (#16)#18
Merged
fix: honor display time format and locale for all clock times (#16)#18
Conversation
Extract appointment calendar logic and time formatting, add custom ScheduleX event views, and wire locale/time preferences through calendar UI. - Add lib/appointment-calendar.ts: shared calendar colors, ISO->ZonedDateTime conversion, event conversion helpers, and month range helper. - Add components/schedule-x/appointment-event-views.tsx: custom ScheduleX components for month grid, month agenda and time grid that use locale/timeFormat and show icons, people and location. - Refactor calendar pages (app/calendar/page.tsx) and dashboard strip (app/dashboard/CalendarStrip.tsx) to use the new helpers, plug in events service, pass locale/timeFormat/timezone, and use custom components. Replace inline color config and event conversion logic with shared utilities. - Update display utilities (lib/display.ts): add TimeFormat type and functions for formatting date/time and ScheduleX time-axis options. Add helpers used by components and tests. - Update StageHistoryDialog to read locale/timeFormat preferences and use formatDateTime for entry timestamps. - Add tests: __tests__/display.test.ts for formatting/time-axis behavior and extend StageHistoryDialog.test.tsx to cover 24-hour preference rendering. Also clear localStorage in test setup and refine mocked updateHistoryEntry shape. These changes centralize calendar/event formatting, support user preferences (locale/time format/timezone) consistently across calendar UIs, and add custom visual event components for ScheduleX.
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.
Summary
User-visible times now follow Settings → Display (
display.timeFormat,display.locale,display.timeZone) across stage history, Schedule-X (month grid, month agenda, dashboard week strip), and existing appointment tables/lists. Formatting is centralized indisplay.ts; calendar wiring is shared viaappointment-calendar.tsand custom Schedule-X components.Changes
lib/display.ts:formatDateTime,scheduleXTimeAxisFormatOptions,formatTimeFromEpochMs,formatTimeRangeFromZonedwith explicithour12.lib/appointment-calendar.ts:APPOINTMENT_CALENDAR_COLORS,resolveTimeZone,isoToZonedDateTime,appointmentsToScheduleXEvents,getMonthRange/formatLocalDateTimefor the calendar page.components/schedule-x/appointment-event-views.tsx:createAppointmentScheduleXCustomComponentsformonthGridEvent,monthAgendaEvent,timeGridEvent.app/calendar/page.tsx: Passeslocale, timezone,timeAxisFormatOptions,customComponents; inner Schedule-X subtree keyed bylocale+timeFormat+timeZoneId;calendar.setThemeon theme change.app/dashboard/CalendarStrip.tsx: Same preferences and Schedule-X behavior as calendar page (no longer browser-only TZ for the strip).components/StageHistoryDialog.tsx:usePreference+formatDateTime(removed hardcodeden-US).__tests__/display.test.ts; Stage History 24h case +localStoragecleanup;updateHistoryEntrymock typing fix.Notes