Frontend: render timestamps in the instance timezone (Intl), once there's a display #42
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
The instance-locale milestone exposed
default_timezone(IANA name, e.g.Europe/Stockholm)via
GET /api/config+useConfig(). It is deliberately not consumed in the UI yet — thereare currently no human-facing timestamp displays (the only date shown is
recording_date, aplain
DATEwith no time/zone). Building a formatter now would be dead code (YAGNI).This issue tracks wiring it up when the first timestamp display lands.
Ask
When the UI starts showing UTC timestamps (e.g. an audit-history view, object
created_at/updated_at, or similar):formatTimestamp(utcIso, timeZone, locale)helper usingIntl.DateTimeFormat(locale, { timeZone }), readingtimeZonefromuseConfig().default_timezoneand
localefrom the active i18n language.Related
need the same
default_timezonevalue plus a Rust tz library.Notes
Done — merged to
main(fe44803).Added a shared
formatTimestamp(value, timeZone, locale)helper (web/src/lib/format-timestamp.ts) that renders a UTC ISO timestamp as date + short time in the instance timezone + active locale, viaIntl.DateTimeFormat. The objects-table "Updated" column now routes through it — previously it was an inline, date-only, unguardedIntl.DateTimeFormatthat would have thrown aRangeErrorand crashed the table on a misconfigureddefault_timezone.Key points:
timeZonefalls back to UTC formatting (try/catch) rather than crashing.lib/format-date.ts:null→ "—", non-string →String(value), unparseable → returned unchanged.America/New_York) and the invalid-zone no-throw case.Gate green: 293 tests pass, largest chunk 90.2 KB gz (budget 250),
check:colorsclean.Future timestamp displays (object-detail created/updated, audit history, when they land) route through the same helper.