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:
@@ -15,6 +15,7 @@ import {
|
||||
type Halacha, type CanonicalInstance,
|
||||
} from "@/lib/api/precedent-library";
|
||||
import { AuthorityBadge, ruleTypeLabel } from "./halacha-meta";
|
||||
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||
|
||||
/** #81 strict-rubric flags — why an item was held back from auto-approval. */
|
||||
const QUALITY_FLAG_LABELS: Record<string, string> = {
|
||||
@@ -28,15 +29,6 @@ const QUALITY_FLAG_LABELS: Record<string, string> = {
|
||||
nevo_preamble_leak: "דליפת רציו נבו",
|
||||
};
|
||||
|
||||
function formatDate(iso: string | null | undefined) {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
return new Date(iso).toLocaleDateString("he-IL");
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
|
||||
/* Strip Unicode bidi marks that render as zero-width but shift visual position. */
|
||||
function cleanCitation(s: string | null | undefined): string {
|
||||
if (!s) return "—";
|
||||
|
||||
@@ -31,15 +31,7 @@ import {
|
||||
FormattedCitation,
|
||||
CitationCopyButton,
|
||||
} from "./formatted-citation";
|
||||
|
||||
function formatDate(iso: string | null) {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
return new Date(iso).toLocaleDateString("he-IL");
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||
|
||||
function cleanCitation(s: string | null | undefined): string {
|
||||
if (!s) return "—";
|
||||
|
||||
@@ -14,15 +14,7 @@ import {
|
||||
} from "@/lib/api/precedent-library";
|
||||
import { PRACTICE_AREAS, PRECEDENT_LEVELS } from "./practice-area";
|
||||
import { AuthorityBadge } from "./halacha-meta";
|
||||
|
||||
function formatDate(iso: string | null) {
|
||||
if (!iso) return "—";
|
||||
try {
|
||||
return new Date(iso).toLocaleDateString("he-IL");
|
||||
} catch {
|
||||
return iso;
|
||||
}
|
||||
}
|
||||
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||
|
||||
/** Score chip — boxed, gold-deep, tabular (mockup 07 `.score`). Sits at the
|
||||
* end of the meta row via `ms-auto`. White fill on gold-wash halacha cards. */
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from "@/lib/api/precedent-library";
|
||||
import { ApiError } from "@/lib/api/client";
|
||||
import { useProgress } from "@/lib/api/documents";
|
||||
import { formatDateShort } from "@/lib/format-date";
|
||||
import {
|
||||
PRACTICE_AREAS, PRECEDENT_LEVELS, SOURCE_TYPES,
|
||||
} from "./practice-area";
|
||||
@@ -192,7 +193,7 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
||||
{conflict.citation}
|
||||
{conflict.case_name && ` — ${conflict.case_name}`}
|
||||
{conflict.court && ` · ${conflict.court}`}
|
||||
{conflict.date && ` · ${new Date(conflict.date).toLocaleDateString("he-IL")}`}
|
||||
{conflict.date && ` · ${formatDateShort(conflict.date)}`}
|
||||
</p>
|
||||
{conflict.halacha_extraction_status && (
|
||||
<p className="text-danger/60 text-[0.72rem]">
|
||||
|
||||
Reference in New Issue
Block a user