Dates, numbers and locale are core infrastructure, not per-feature formatting: one shared layer formats them, and every date in the app goes through it.

The problem

Every app eventually has a dozen ways to print a date. One component calls .toLocaleString(), another hand-rolls a percent, a third shows Invalid Date when the backend sends something odd. In a dense table that inconsistency is the whole screen.

Worse, each of those decides the locale on its own, usually by not deciding. Someone in London sees month-first dates in one column and day-first in another, in a timezone that isn’t theirs.

What I concluded

Treat formatting like a color token. One format namespace of pure functions: each takes an unknown value and returns a display string. It reads the person’s region and timezone at call time, never baked in. Region controls formats while the interface language stays the same, so a person can keep English labels and still get their own dates, separators and currency.

format.date(order.placedAt);            // "14 Nov 2026"
format.number(order.items);             // "1,204"
format.percent({ part: 3, total: 4 });  // "75%"
format.date(order.shippedAt, { fallback: "Not yet" });

Every function has the same shape and the same empty rule. Null, missing, or unparseable returns one shared empty mark, and the table cell announces it as “No value”. Inputs are normalized first (epoch numbers, numeric strings, ISO strings), and a bad one becomes null, never Invalid Date. The Intl instances are cached by their options and the cache is cleared when the person changes region or timezone.

One consumer: the date range picker

A range picker is where locale and time meet a person directly, and it uses the same layer for every label it shows. It also stages: presets, calendar clicks and typed dates stay inside the panel until Apply, so the page never refetches on a half-made range. A rolling preset is stored as a preset, so “Last 30 days” still means that when the saved view is opened next month. The opening highlight isn’t a pick, so the first click starts a new range rather than stretching the old one.

Rules

  • Format at render, through the layer. Views never call .toFixed() or .toLocaleString() directly.
  • Region and timezone are read, not assumed. Change them and every date in the app follows.
  • One empty value. Visually a dash, announced as “No value”.
  • Pickers stage until Apply. One Apply is one URL change, one fetch, one step for Back.
  • Presets stay presets. Store the name, not the two dates it resolves to today.

What you get

Every date and number in the app agrees, in the person’s own region, and changing that preference is one setting rather than a hunt through features. New features get it for free by not writing formatting at all.

The demo shows the staged picker: click around, Cancel, and watch the fetch count not move. It’s fixed to US formats and doesn’t switch region. Related: Filters, Date brush, URL state.