Skip to content

fix: honor display time format and locale for all clock times (#16)#18

Merged
leobrqz merged 1 commit intomainfrom
bugfix/time-format
Mar 22, 2026
Merged

fix: honor display time format and locale for all clock times (#16)#18
leobrqz merged 1 commit intomainfrom
bugfix/time-format

Conversation

@leobrqz
Copy link
Copy Markdown
Owner

@leobrqz leobrqz commented Mar 22, 2026

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 in display.ts; calendar wiring is shared via appointment-calendar.ts and custom Schedule-X components.

Changes

  • lib/display.ts: formatDateTime, scheduleXTimeAxisFormatOptions, formatTimeFromEpochMs, formatTimeRangeFromZoned with explicit hour12.
  • lib/appointment-calendar.ts: APPOINTMENT_CALENDAR_COLORS, resolveTimeZone, isoToZonedDateTime, appointmentsToScheduleXEvents, getMonthRange / formatLocalDateTime for the calendar page.
  • components/schedule-x/appointment-event-views.tsx: createAppointmentScheduleXCustomComponents for monthGridEvent, monthAgendaEvent, timeGridEvent.
  • app/calendar/page.tsx: Passes locale, timezone, timeAxisFormatOptions, customComponents; inner Schedule-X subtree keyed by locale + timeFormat + timeZoneId; calendar.setTheme on 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 hardcoded en-US).
  • Tests: __tests__/display.test.ts; Stage History 24h case + localStorage cleanup; updateHistoryEntry mock typing fix.

Notes

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.
@leobrqz leobrqz self-assigned this Mar 22, 2026
@leobrqz leobrqz added the fix Fixes a bug label Mar 22, 2026
@leobrqz leobrqz linked an issue Mar 22, 2026 that may be closed by this pull request
@leobrqz leobrqz merged commit 3b4c73a into main Mar 22, 2026
5 checks passed
@leobrqz leobrqz deleted the bugfix/time-format branch March 22, 2026 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: inconsistent time format (UI)

1 participant