Skip to content

Date & Number Format Utils

All date, time, and number formatting uses the native Intl API driven by the client-sent locale — no formatting library (ADR-008, constitution §7.16.3). The helpers live in src/lib/intl/index.ts.

  • formatDate(isoDate, locale) — a YYYY-MM-DD date rendered for the locale.
  • formatTime(isoInstant, locale) / formatDateTime(isoInstant, locale) — instants rendered as locale time / date-time.
  • formatNumber(value, locale) — locale-grouped numbers.
  • formatRelativeTime(target, locale, now = new Date()) — “2 days ago”-style relative phrasing (Intl.RelativeTimeFormat).
  • formatDueDate(dueDate, _locale) — due-date display (date-only).

The active locale comes from the client (message catalogs are Paraglide-compiled, ADR-008); the day boundary for date-sensitive logic is the user’s local day via localTodayISO() (see Sidebar Counts & Local-Today). Because formatting is Intl-based, it adds no bundle weight beyond the platform (§8.2).

Related: Sidebar Counts & Local-Today, Task Attributes API (due dates), My Day & Owner-Scoped Views.