fix(web-ui): display all human-facing timestamps in Asia/Jerusalem (deterministic)
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:
@@ -38,6 +38,7 @@ import {
|
||||
import { useCaseCitations } from "@/lib/api/citations";
|
||||
import { learningKeys } from "@/lib/api/learning";
|
||||
import { LearningStatusBadges } from "@/components/cases/learning-status-badges";
|
||||
import { formatDateTime, formatDateShort } from "@/lib/format-date";
|
||||
import type { CaseStatus } from "@/lib/api/cases";
|
||||
import { toast } from "sonner";
|
||||
import {
|
||||
@@ -72,13 +73,7 @@ function formatSize(bytes: number): string {
|
||||
}
|
||||
|
||||
function formatDate(epoch: number): string {
|
||||
return new Date(epoch * 1000).toLocaleDateString("he-IL", {
|
||||
day: "numeric",
|
||||
month: "short",
|
||||
year: "numeric",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
});
|
||||
return formatDateTime(epoch * 1000);
|
||||
}
|
||||
|
||||
/* ── Main component ─────────────────────────────────── */
|
||||
@@ -568,9 +563,7 @@ export function DraftsPanel({
|
||||
</Badge>
|
||||
)}
|
||||
<span className="text-[0.65rem] text-ink-muted me-auto">
|
||||
{fb.created_at
|
||||
? new Date(fb.created_at).toLocaleDateString("he-IL")
|
||||
: ""}
|
||||
{fb.created_at ? formatDateShort(fb.created_at) : ""}
|
||||
</span>
|
||||
</div>
|
||||
<p className="text-sm leading-relaxed">{fb.feedback_text}</p>
|
||||
|
||||
Reference in New Issue
Block a user