Times are local but unlabelled, and UTC day buckets shift a day west of UTC #38

Closed
opened 2026-10-06 07:55:34 +00:00 by grenade · 0 comments
Owner

Why

The frontend formats dates in six places, three different ways:

Where Zone Labelled Format
lib/format.ts when(): swap, pool-swap and block tables viewer's local no fixed en-GB
ShareChart, PriceChart, StatBar axes and tooltips viewer's local no browser locale (12h or 24h)
NetworkPanel daily table (d.day.slice(0, 10)) UTC no 2026-10-05
FlowChart dayLabel (wormhole page) local, applied to UTC days no Oct 5
VestingPanel local no browser locale
NodePanel start-time tooltip UTC (ISO) implicitly ISO 8601
  1. No zone anywhere. A screenshot or a copied time is ambiguous: the same problem as the "17:00" on the launch announcement, which only made sense once we assumed the poster's timezone.
  2. Off by one day west of UTC. Daily buckets from the API are UTC days (2026-10-05T00:00:00Z, from date_trunc('day', …)). FlowChart formats them in local time, so in any negative-offset zone every bar is labelled the previous day, while NetworkPanel prints the UTC date. The two pages disagree for a viewer in the Americas.
  3. Two formats side by side. A chart axis reads "05:40 PM" next to a table reading "17:40".

What

  • One formatter per kind in lib/format.ts, used everywhere: the same lesson as Field and isStandings, since copies drift.
    • instant(iso): the viewer's local time with its zone, e.g. 06 Oct 2026, 09:04 EEST (timeZoneName: 'short'). Its title carries the UTC ISO time.
    • clock(ms, span): chart axis labels, local, 24h, with the zone said once in the chart's tooltip.
    • utcDay(iso): a day bucket, always formatted with timeZone: 'UTC'. Charts and tables of daily figures say "UTC days".
  • One locale decision: en-GB-style 24h everywhere. It is what the tables already use and it does not vary by viewer.
  • A test that a UTC-midnight bucket formats as its own date in a negative-offset zone, the case that is wrong today.
## Why The frontend formats dates in six places, three different ways: | Where | Zone | Labelled | Format | |---|---|---|---| | `lib/format.ts` `when()`: swap, pool-swap and block tables | viewer's local | no | fixed `en-GB` | | `ShareChart`, `PriceChart`, `StatBar` axes and tooltips | viewer's local | no | browser locale (12h or 24h) | | `NetworkPanel` daily table (`d.day.slice(0, 10)`) | UTC | no | `2026-10-05` | | `FlowChart` `dayLabel` (wormhole page) | **local, applied to UTC days** | no | `Oct 5` | | `VestingPanel` | local | no | browser locale | | `NodePanel` start-time tooltip | UTC (ISO) | implicitly | ISO 8601 | 1. **No zone anywhere.** A screenshot or a copied time is ambiguous: the same problem as the "17:00" on the launch announcement, which only made sense once we assumed the poster's timezone. 2. **Off by one day west of UTC.** Daily buckets from the API are UTC days (`2026-10-05T00:00:00Z`, from `date_trunc('day', …)`). `FlowChart` formats them in local time, so in any negative-offset zone every bar is labelled the previous day, while `NetworkPanel` prints the UTC date. The two pages disagree for a viewer in the Americas. 3. **Two formats side by side.** A chart axis reads "05:40 PM" next to a table reading "17:40". ## What - **One formatter per kind** in `lib/format.ts`, used everywhere: the same lesson as `Field` and `isStandings`, since copies drift. - `instant(iso)`: the viewer's local time **with its zone**, e.g. `06 Oct 2026, 09:04 EEST` (`timeZoneName: 'short'`). Its `title` carries the UTC ISO time. - `clock(ms, span)`: chart axis labels, local, 24h, with the zone said once in the chart's tooltip. - `utcDay(iso)`: a day bucket, always formatted with `timeZone: 'UTC'`. Charts and tables of daily figures say "UTC days". - **One locale decision:** `en-GB`-style 24h everywhere. It is what the tables already use and it does not vary by viewer. - **A test** that a UTC-midnight bucket formats as its own date in a negative-offset zone, the case that is wrong today.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blackbeard/observer#38