fix(web-ui): display all human-facing timestamps in Asia/Jerusalem (deterministic)
All checks were successful
G12 Leak-Guard / leak-guard (pull_request) Successful in 3s
Lint — undefined names / undefined-names (pull_request) Successful in 10s

Storage stays UTC (DB TIMESTAMPTZ, API ISO-UTC) — only the display layer is
localized, and now deterministically: every timestamp renders pinned to
Asia/Jerusalem via a single Intl-based formatter, so SSR (UTC container) and
the browser agree on any runtime. No layout/visible-format change — only the tz.

- New single date formatter web-ui/src/lib/format-date.ts (G2): formatDate /
  formatDateShort / formatDateLong / formatDateTime / formatDateTimeFull /
  formatTime / formatIsoDate + Israel helpers getIsraelYear / israelDayKey /
  israelMidnightMs / israelParts + formatRelative (long/short/tight wording).
- Routed all ad-hoc toLocaleDateString/toLocaleTimeString/toLocaleString +
  hand-rolled new Date(...).get*() / toISOString().slice(0,10) timestamp call
  sites (30 files) through it. Number toLocaleString left untouched.
- Spec: added INV-UI9 to docs/spec/X6 (UTC storage, Asia/Jerusalem display).

Display-only; no layout/design/IA change → Claude Design gate N/A.
Invariants: G2 (single date formatter, no parallel ad-hoc formatting), INV-UI9.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-30 17:18:09 +00:00
parent c71bbc0df2
commit 67c2c43777
32 changed files with 384 additions and 235 deletions

View File

@@ -28,19 +28,7 @@ import {
import { useCases, useRestoreCase, type Case } from "@/lib/api/cases";
import { subtypeOf } from "@/components/cases/appeal-type-bars";
import { APPEAL_SUBTYPE_LABELS, type AppealSubtype } from "@/lib/practice-area";
function formatDate(iso?: string | null) {
if (!iso) return "—";
try {
return new Date(iso).toLocaleDateString("he-IL", {
day: "2-digit",
month: "2-digit",
year: "numeric",
});
} catch {
return iso;
}
}
import { formatDate, getIsraelYear } from "@/lib/format-date";
// type chip styling per mockup 05 (.t-lic / .t-bet / .t-comp)
const TYPE_CHIP: Record<string, string> = {
@@ -177,8 +165,8 @@ export default function ArchivePage() {
const set = new Set<string>();
for (const c of rows) {
if (!c.archived_at) continue;
const y = new Date(c.archived_at).getFullYear();
if (!Number.isNaN(y)) set.add(String(y));
const y = getIsraelYear(c.archived_at);
if (y !== null) set.add(String(y));
}
return [...set].sort((a, b) => Number(b) - Number(a));
}, [rows]);
@@ -209,7 +197,7 @@ export default function ArchivePage() {
if (yearFilter !== "all") {
all = all.filter((r) => {
const iso = r.original.archived_at;
return iso != null && String(new Date(iso).getFullYear()) === yearFilter;
return iso != null && String(getIsraelYear(iso)) === yearFilter;
});
}
return all;