Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(ui): format dates and times in the viewer's locale
rcourtmanb35eec977313
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 10aa4919e5..eb1856bdc9 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -399,7 +399,12 @@ only in the day group header, which scrolls out of sight, and a hardcoded`en-US` format misreported the time of day to everyone outside the US(#1687, #1685). `useAlertHistoryState` owns both formatters(`formatAlertRowTime`, `formatAlertRowTimestamp`) so the desktop table and the-mobile list cannot drift apart.+mobile list cannot drift apart. The day group `fullLabel` built in+`frontend-modern/src/features/alerts/alertHistoryModel.ts` follows the same+rule, because a header reading "Thursday, August 6, 2026" to a reader whose+rows are ordered day-month is the same defect one level up. See the+localization boundary in the frontend-primitives contract for the shared+formatting rule and the audit that enforces it.Alert browser surfaces no longer manage their own runtime-capabilities fetch or`hasAIAlertsFeature` prop chain. `frontend-modern/src/pages/Alerts.tsx` and thediff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 46c67ec98a..bd15136a02 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -252,6 +252,21 @@ wizard shell, or page-local preview renderer for monitored-system impact.Frontend localization is a shared primitive boundary. Locale support must flowthrough typed message catalogs with an English fallback and explicit seedlocale coverage rather than page-local string switches.++Date and number formatting is part of that boundary and is separate from the+message catalog. Every `toLocaleString`, `toLocaleDateString`,+`toLocaleTimeString`, and `Intl.*` constructor must pass `undefined` as the+locale so the runtime resolves the viewer's own locale, including whether they+expect a 12 or 24 hour clock and which order the date parts go in. A literal+tag such as `'en-US'` shows US conventions to every reader everywhere. The+`canonical-shared/no-hardcoded-format-locale` rule in+`frontend-modern/scripts/canonical-platform-audit.mjs` blocks new occurrences;+a call that genuinely needs a fixed locale, such as a stable machine-readable+export, belongs in that rule's `allowFiles` with a reason rather than as a bare+literal. The rule exists because this regressed silently once already: #1279+delocalized the "Last refresh" clock in `App.tsx`, and the v6 rewrite that+moved that logic into `frontend-modern/src/useAppRuntimeState.ts` reinstated+the hardcoded form, which shipped through v6 GA until #1685.`frontend-modern/src/i18n/locales.ts` owns locale normalization, the supportedlocale registry, and fallback chains; `frontend-modern/src/i18n/messages.ts`owns the typed catalog shape; and `frontend-modern/src/i18n/policy.ts` owns thediff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.jsonindex 37ba884032..5ade515243 100644--- a/frontend-modern/browser-verification.json+++ b/frontend-modern/browser-verification.json@@ -1,28 +1,23 @@{"version": 1,- "base_sha": "9615b5f2b0e461809399a7ea101a4e75c082e202",- "verified_at": "2026-08-06T19:55:00Z",+ "base_sha": "eac9ffcabf8f2c108c0c2d67f43c91ac4db5023a",+ "verified_at": "2026-08-06T19:54:45Z","result": "passed","changed_paths": [- "frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts",- "frontend-modern/src/features/vmware/VmwarePageSurface.tsx",- "frontend-modern/src/hooks/useWorkloads.ts",- "frontend-modern/src/types/resource.ts"+ "frontend-modern/src/features/alerts/alertHistoryModel.ts",+ "frontend-modern/src/useAppRuntimeState.ts"],"content_sha256": {- "frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts": "ad066cb0146c00f5d4e4763a80152dfbcfcb85643f69ed416897309e0e0733ee",- "frontend-modern/src/features/vmware/VmwarePageSurface.tsx": "5525ce1b10c753bc56dd0fddb53a089fc2052fa5dcc271884a86619af1896c6e",- "frontend-modern/src/hooks/useWorkloads.ts": "b49585f16a65ef30d4a6dd27358674ca912f9313fd6c73919150b86ee6e404b7",- "frontend-modern/src/types/resource.ts": "1618f592fae6d13ef4f366f3b60f6049293f41493292024903884115ce423d5e"+ "frontend-modern/src/features/alerts/alertHistoryModel.ts": "71c9123482dcbbeb2dc319063f3e00e56e6a7ec7fdae4df6c0e9aa78aac8ea6d",+ "frontend-modern/src/useAppRuntimeState.ts": "7061dbfc8aed3b569526af9018e4f70034c6dee02752295fc449d19283df7753"},"routes": [- "/vmware/overview",- "/proxmox?status=all"+ "/alerts/history"],"viewports": [{- "width": 1680,- "height": 1000+ "width": 1280,+ "height": 800},{"width": 390,@@ -30,26 +25,17 @@}],"states": [- "vSphere VM table for a user with no saved preference at 1680px: header is Name, ID, CPU, Mem, Disk, Uptime, Tags, Net I/O, Disk I/O, so Tags is default-visible again on the scope that used to hide it",- "vSphere Tags cells now vary per row instead of repeating: warehouse-api-01 3 dots, warehouse-db-01 4, client-portal-01 2, finance-jump-01 3, ops-observability-01 2, edge-api-01 3, and 38 dots across the whole table",- "vSphere VMs that carry no vCenter tags render an empty Tags cell rather than falling back to the provenance keyword set: etl-batch-01 and ingress-proxy-02 show 0 dots",- "vSphere host group-header rows carry no tag dots, so host tags do not leak into the VM rows grouped beneath them",- "vSphere VM table for a user whose saved preference predates this change (seeded workloadsHiddenColumns:vmware-vms of aiContext/os/ip): the one-time migration adds only backup, the applied marker records aiContext/backup, and Tags stays visible",- "vSphere column picker reports 4 hidden and offers Tags checked, Backup unchecked, AI Context unchecked, OS unchecked, IP unchecked, Disk/Uptime/Net I/O/Disk I/O checked",- "vSphere at 390px: the phone stage renders Name, CPU, Mem across 25 rows with Tags dropped by the responsive stage as the wide-only contract requires, and no horizontal body overflow (table scrollWidth within container clientWidth for both tables)",- "Proxmox workload table unaffected at 1680px: Tags and Backup both still visible with genuine per-guest counts varying 3 to 7 dots per row, and the stored hidden list unchanged at aiContext/os/ip",- "Tag tooltip on a vSphere dot reads the real vCenter label Backup:Nightly rather than a provenance string",- "Filtered state after clicking that dot: search reads tags:Backup:Nightly and the table narrows from 18 VMs to the 3 that carry the tag (warehouse-api-01, warehouse-db-01, mariadb-replica-01) plus their host group headers"+ "Browser locale resolved as en-GB for the whole check, so a hardcoded en-US format is visibly distinguishable from the viewer's own",+ "Last refresh footer renders 20:52:55 on a 24 hour clock; the previous hardcoded en-US with hour12 true produced 8:52:55 PM for the same instant",+ "Alert history day group header carries the full-date title 'Thursday, 6 August 2026' in UK day-month order rather than the previous 'Thursday, August 6, 2026'",+ "Alert history page renders normally at 1280px and 390px with the reformatted labels and no horizontal document overflow",+ "Canonical platform audit passes clean across src with the new locale rule active",+ "Reintroducing a hardcoded en-US locale into useAppRuntimeState.ts makes the audit fail at that exact line, then passes again once reverted"],"interactions": [- "Built this worktree's frontend and backend and ran a mock-mode scratch instance on port 7712 so the page exercised this branch's adapter rather than the shared dev instance",- "Cleared every workloadsHiddenColumns scope key to reproduce a first-time user, then reloaded /vmware/overview",- "Seeded a pre-change workloadsHiddenColumns:vmware-vms preference of aiContext/os/ip and reloaded to confirm the migration now retires only backup and leaves tags alone",- "Opened the View preferences popover and the Columns multiselect on /vmware/overview to read the offered toggles and their checked state",- "Hovered a vSphere tag dot to read its tooltip, then clicked it to drive the tag filter and counted the surviving rows",- "Resized between 1680x1000 and 390x844 with a reload at each stage, and measured documentElement scrollWidth against clientWidth plus per-table scrollWidth against container clientWidth",- "Navigated to /proxmox?status=all at 1680px to confirm Proxmox tag counts and stored preferences are untouched",- "Queried /api/resources?source=vmware-vsphere&type=vm to confirm the flat tags array keeps the six provenance strings and appends real labels, while vmware.tags carries only the operator's labels and is empty for untagged VMs",- "Re-verified after rebasing onto main 9615b5f2b: rebuilt frontend and backend from the rebased tree, reloaded /vmware/overview at 1680x1000 and reproduced the same 38 tag dots with the same per-row counts, the same Backup:Nightly tooltip, and the same tags:Backup:Nightly filter narrowing to 3 VMs"+ "Read the rendered Last refresh footer text and the day group header title attribute directly from the DOM in an en-GB browser",+ "Swept the whole of frontend-modern/src with the audit's own regex to confirm no remaining hardcoded locale literals before adding the rule",+ "Temporarily reverted one fix to confirm the new audit rule fires on the regression, then restored it and re-ran the audit clean",+ "Reloaded the history route at both viewports after the change"]}diff --git a/frontend-modern/scripts/canonical-platform-audit.mjs b/frontend-modern/scripts/canonical-platform-audit.mjsindex b0b9c43e71..1a4eb28ebd 100644--- a/frontend-modern/scripts/canonical-platform-audit.mjs+++ b/frontend-modern/scripts/canonical-platform-audit.mjs@@ -326,6 +326,20 @@ function pushMatch(relativePath, content, index, rule, message) {}const HELPER_RULES = [+ {+ // Date and number formatting must resolve the viewer's locale, which means+ // passing undefined rather than a literal tag. A hardcoded 'en-US' shows a+ // 12 hour clock and US date order to everyone, wherever they are. This has+ // regressed once already: #1279 fixed the "Last refresh" clock in App.tsx+ // and the v6 rewrite of that state hook reinstated the hardcoded form+ // (#1685). If a call genuinely needs a fixed locale, such as a stable+ // machine-readable export, add the file to this rule's allowFiles.+ rule: 'canonical-shared/no-hardcoded-format-locale',+ regex:+ /(?:toLocale(?:Date|Time)?String|Intl\.(?:DateTimeFormat|NumberFormat|RelativeTimeFormat|ListFormat))\(\s*['"][A-Za-z]{2}(?:-[A-Za-z0-9]+)*['"]/g,+ message:+ "Do not hardcode a locale in date or number formatting. Pass undefined so the viewer's own locale and clock convention are used.",+ },{rule: 'canonical-infrastructure/no-local-empty-state-copy',regex:diff --git a/frontend-modern/src/features/alerts/alertHistoryModel.ts b/frontend-modern/src/features/alerts/alertHistoryModel.tsindex 7d6f71e5fb..ea10cfed5f 100644--- a/frontend-modern/src/features/alerts/alertHistoryModel.ts+++ b/frontend-modern/src/features/alerts/alertHistoryModel.ts@@ -455,7 +455,9 @@ export function groupAlertHistoryItems(alertData: HistoryItem[]) {groups.set(dateKey, {date: dateOnly,label: formatAlertHistoryGroupLabel(dateOnly, todayStart, yesterdayStart),- fullLabel: dateOnly.toLocaleDateString('en-US', {+ // Viewer's locale, not en-US: this is the day header a reader scrolls+ // past in the history, so it has to read in their own date order.+ fullLabel: dateOnly.toLocaleDateString(undefined, {weekday: 'long',year: 'numeric',month: 'long',diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.tsindex 893b514fab..1cba6b8175 100644--- a/frontend-modern/src/useAppRuntimeState.ts+++ b/frontend-modern/src/useAppRuntimeState.ts@@ -499,11 +499,13 @@ export const useAppRuntimeState = () => {const formatLastUpdate = (timestamp: number) => {if (!timestamp) return '';const date = new Date(timestamp);- return date.toLocaleTimeString('en-US', {+ // Passing undefined lets the runtime pick the viewer's locale, including+ // whether it wants a 12 or 24 hour clock. #1279 made this change once; the+ // v6 rewrite of this state hook reinstated the hardcoded form (#1685).+ return date.toLocaleTimeString(undefined, {hour: 'numeric',minute: '2-digit',second: '2-digit',- hour12: true,});};