feat(dates): render user-facing dates via preferences (IFC-2721)
What
Re-homes the date-rendering slice (IFC-2721) onto the re-split ple-prefs-* stack. App-wide dates render through the user's effective date-format + timezone preferences, falling back to the browser locale when nothing is set.
shared/context/date-preferences-contextβ{ pattern, timezone }+useFormatDate, no dependency onentities.entities/preferences/ui/date-preferences-providerβ fills the context fromuseGetEffectivePreferences.shared/utils/date+shared/components/display/date-display/duration-displayand consumers across nodes, diff, navigation, events, metadata.
Stack / relationship to the old PR
Supersedes #9842 (ple-user-preferences-datedisplay), built on the older ple-user-preferences-* lineage. The three date-rendering commits were cherry-picked onto ple-prefs-global-permission and adapted to the refactored preferences layer:
patternForKeynow exported fromdomain/rules/date-format(the olddomain/date-format-presets.tsis gone).- provider reads
useGetEffectivePreferencesand compares the uppercasePreferenceSource("DEFAULT").
Base: stacks on #9871 (ple-prefs-global-permission) β #9880 β #9870. Draft until the base PRs land.
Verification
tsc --noEmit clean for all ported files locally. Full unit/e2e run deferred to CI.
π€ Generated with Claude Code
Summary by cubic
Render all user-facing dates through one preference-aware path that honors each userβs effective date_format and timezone, falling back to the browser locale/zone when unset. Meets IFC-2721 with a unified API, app-wide migrations, and removal of per-call-site patterns for consistent display.
-
New Features
- Added
DatePreferencesContext+useFormatDate("datetime" | "date" | "relative") with browser fallback; exposestimezonefor rare explicit-pattern cases. - Added
DatePreferencesProvider(usesuseGetEffectivePreferences+resolveDatePreferences); mounts only when authenticated and treats"DEFAULT"as unset. - Updated
DateDisplay: recent β relative; older β date; tooltip shows full preferred datetime+timezone; addedfullTimestampfor inline full datetime. Migrated events, search, time selector, diffs, metadata/tooltips, node tables/details (DateTime attributes now show full preferred format inline), relationships, tokens, and filter tags. Added pureformatWithPattern({ pattern, timezone })inshared/utils/dateusing@date-fns/tz; exporteddateFormatPatternanddateOnlyPattern; expanded tests and docs.
- Added
-
Refactors
- Removed the
DateDisplayper-call-sitedateFormatescape hatch so all dates follow preferences; updated tasks homepage and light proposed-change item to use the default behavior. - Compact (>7d) rendering now uses
formatDate(date, "date"); invalid dates and unknown IANA timezones degrade to readable fallbacks. DurationDisplay shows "β" whenendDateis missing. Provider fetch is gated on auth to avoid pre-auth 401s. Pre-bundled@date-fns/tzin Vitest to prevent reload flakes.
- Removed the