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

@@ -41,6 +41,7 @@ import {
useDeleteChat,
type ChatMessage,
} from "@/lib/api/training";
import { formatDateShort } from "@/lib/format-date";
import { useQueryClient } from "@tanstack/react-query";
export function ChatPanel() {
@@ -200,7 +201,7 @@ function ConversationsSidebar({
<span className="tabular-nums">{c.message_count}</span>
<MessageSquare className="w-3 h-3" />
<span className="grow text-end">
{new Date(c.last_message_at).toLocaleDateString("he-IL")}
{formatDateShort(c.last_message_at)}
</span>
<button
onClick={(e) => { e.stopPropagation(); onDelete(c.id); }}

View File

@@ -11,6 +11,7 @@ import { Badge } from "@/components/ui/badge";
import { Skeleton } from "@/components/ui/skeleton";
import { useCorpus, useDeleteCorpusEntry, type CorpusDecision } from "@/lib/api/training";
import { CorpusDetailDrawer } from "./corpus-detail-drawer";
import { formatDateShort as formatDate } from "@/lib/format-date";
/*
* Corpus tab: table of all decisions currently in the style corpus.
@@ -30,15 +31,6 @@ function formatChars(n: number) {
return `${(n / 1000).toFixed(1)}K`;
}
function formatDate(iso: string) {
if (!iso) return "—";
try {
return new Date(iso).toLocaleDateString("he-IL");
} catch {
return iso;
}
}
function Row({
item, onOpen,
}: { item: CorpusDecision; onOpen: () => void }) {

View File

@@ -32,6 +32,7 @@ import { Skeleton } from "@/components/ui/skeleton";
import { ScrollArea } from "@/components/ui/scroll-area";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Markdown } from "@/components/ui/markdown";
import { formatDateShort, formatDateTimeFull } from "@/lib/format-date";
import {
useCuratorPrompt,
useCuratorStats,
@@ -256,7 +257,7 @@ function RecentFindings() {
)}
<span className="grow text-ink-muted text-end">
<Clock className="w-3 h-3 inline me-1" />
{new Date(f.created_at).toLocaleDateString("he-IL")}
{formatDateShort(f.created_at)}
</span>
</div>
<p className="text-sm text-ink leading-relaxed">{f.lesson_text}</p>
@@ -291,7 +292,7 @@ function CuratorPromptCard() {
<h3 className="text-navy font-semibold">{data.filename}</h3>
<p className="text-[0.72rem] text-ink-muted">
{data.bytes.toLocaleString("he-IL")} בייטים ·
עודכן: {new Date(data.last_modified * 1000).toLocaleString("he-IL")}
עודכן: {formatDateTimeFull(data.last_modified * 1000)}
</p>
</div>
<Button asChild variant="outline" size="sm">

View File

@@ -9,6 +9,7 @@ import {
useReconciliationLedger, useStyleDistance, usePairDetail, usePromoteLearning,
type DraftFinalPair,
} from "@/lib/api/learning";
import { formatDateShort as fmtDate } from "@/lib/format-date";
/**
* /training "למידה" tab (T6/T13) — the reconciliation ledger (INV-LRN4): every
@@ -28,11 +29,6 @@ const STATUS_CLASS: Record<string, string> = {
lessons_folded: "bg-emerald-50 text-emerald-800 border-emerald-300/60",
};
function fmtDate(iso: string | null) {
if (!iso) return "—";
try { return new Date(iso).toLocaleDateString("he-IL"); } catch { return iso; }
}
function StyleDistanceDetail({ caseNumber }: { caseNumber: string }) {
const { data, isPending, error } = useStyleDistance(caseNumber);
if (isPending) return <Loader2 className="w-4 h-4 animate-spin text-ink-muted" />;

View File

@@ -37,6 +37,7 @@ import {
usePatchLesson,
type DecisionLesson,
} from "@/lib/api/training";
import { formatDateShort } from "@/lib/format-date";
const CATEGORIES = [
{ value: "general", label: "כללי" },
@@ -224,7 +225,7 @@ function LessonItem({
{reviewBadge.label}
</Badge>
<span className="grow text-ink-muted tabular-nums">
{new Date(lesson.created_at).toLocaleDateString("he-IL")}
{formatDateShort(lesson.created_at)}
</span>
</div>