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

@@ -9,6 +9,7 @@ import {
type ApprovalCategory,
type ApprovalSeverity,
} from "@/lib/api/chair";
import { formatDateLong } from "@/lib/format-date";
/**
* מרכז אישורים — דפנה (INV-G10).
@@ -35,18 +36,7 @@ const SEVERITY_RAIL: Record<ApprovalSeverity, string> = {
ok: "border-s-success",
};
function formatDate(iso?: string | null): string {
if (!iso) return "";
try {
return new Date(iso).toLocaleDateString("he-IL", {
day: "numeric",
month: "long",
year: "numeric",
});
} catch {
return "";
}
}
const formatDate = (iso?: string | null) => formatDateLong(iso);
function ApprovalCard({ cat }: { cat: ApprovalCategory }) {
const cleared = cat.count === 0;

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;

View File

@@ -16,6 +16,7 @@ import {
type ChairFeedback,
type FeedbackCategory,
} from "@/lib/api/feedback";
import { formatDateLong } from "@/lib/format-date";
/**
* מרכז הערות יו"ר — הדף המרכזי לטיפול בכל הערות דפנה שנרשמו על טיוטות
@@ -33,18 +34,7 @@ const CAT_CHIP: Record<FeedbackCategory, string> = {
other: "bg-rule-soft text-ink-soft",
};
function formatDate(iso?: string | null): string {
if (!iso) return "";
try {
return new Date(iso).toLocaleDateString("he-IL", {
day: "numeric",
month: "long",
year: "numeric",
});
} catch {
return "";
}
}
const formatDate = (iso?: string | null) => formatDateLong(iso);
function FeedbackCard({ fb }: { fb: ChairFeedback }) {
const resolve = useResolveFeedback();

View File

@@ -36,6 +36,7 @@ import {
type SubscriptionUsage,
type UsageWindow,
} from "@/lib/api/operations";
import { formatTime, israelParts } from "@/lib/format-date";
function mb(bytes: number): string {
return `${Math.round((bytes || 0) / 1024 / 1024)}MB`;
@@ -46,8 +47,7 @@ function mb(bytes: number): string {
// and resumes on its own when a window resets.
function usageResetLabel(iso: string | null): string {
if (!iso) return "—";
const d = new Date(iso);
return `איפוס ${d.toLocaleTimeString("he-IL", { hour: "2-digit", minute: "2-digit" })}`;
return `איפוס ${formatTime(iso)}`;
}
function UsageMeter({ label, w }: { label: string; w?: UsageWindow | null }) {
@@ -195,8 +195,9 @@ function nextSaturday18(): Date {
}
const HE_DAYS = ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"];
function fmtDeadline(iso: string): string {
const d = new Date(iso);
return `${HE_DAYS[d.getDay()]} ${pad2(d.getDate())}/${pad2(d.getMonth() + 1)} ${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
const p = israelParts(iso);
if (!p) return "—";
return `${HE_DAYS[p.weekday]} ${pad2(p.day)}/${pad2(p.month)} ${pad2(p.hour)}:${pad2(p.minute)}`;
}
function BurstControl({ s }: { s: OpsService }) {

View File

@@ -26,6 +26,7 @@ import {
useRunScript,
type ScriptRunResult,
} from "@/lib/api/scripts";
import { formatDateLong } from "@/lib/format-date";
/*
* /scripts — catalog of everything under scripts/, rendered as the
@@ -354,11 +355,7 @@ export default function ScriptsPage() {
const lastModified =
data?.last_modified != null
? new Date(data.last_modified * 1000).toLocaleDateString("he-IL", {
year: "numeric",
month: "long",
day: "numeric",
})
? formatDateLong(data.last_modified * 1000)
: null;
const giteaBase = data?.gitea_url ?? null;

View File

@@ -19,6 +19,7 @@ import {
type DriftEntry,
type PaperclipAgent,
} from "@/lib/api/paperclip-agents";
import { formatDateShort } from "@/lib/format-date";
const ROLE_LABEL: Record<string, string> = {
ceo: "CEO",
@@ -211,7 +212,7 @@ function PairCard({ pair }: { pair: AgentPair }) {
</Button>
{pair.master?.updated_at && (
<span className="text-[0.7rem] text-ink-light">
עודכן: {new Date(pair.master.updated_at).toLocaleDateString("he-IL")}
עודכן: {formatDateShort(pair.master.updated_at)}
</span>
)}
</div>

View File

@@ -13,6 +13,7 @@ import {
TableRow,
} from "@/components/ui/table";
import { useSkills, type Skill } from "@/lib/api/skills";
import { formatIsoDate } from "@/lib/format-date";
function formatChars(skill: Skill): string {
// Mockup column = "גודל (תווים)" — the DB markdown char count, grouped.
@@ -21,13 +22,8 @@ function formatChars(skill: Skill): string {
}
function formatUpdated(iso: string | null): string {
if (!iso) return "—";
try {
// ISO-style date to match the mockup (2026-06-09), tabular.
return new Date(iso).toISOString().slice(0, 10);
} catch {
return "—";
}
// ISO-style date to match the mockup (2026-06-09), tabular — Israel-time day.
return formatIsoDate(iso);
}
/**