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:
@@ -105,13 +105,36 @@ TanStack Query — *Important Defaults* (staleTime/refetch) (https://tanstack.co
|
|||||||
**אכיפה:** `halacha_backlog` מרונדר ב-/operations (לא נזרק); `findings_approved` (review_status, צרכן אמיתי)
|
**אכיפה:** `halacha_backlog` מרונדר ב-/operations (לא נזרק); `findings_approved` (review_status, צרכן אמיתי)
|
||||||
החליף את `findings_applied` (דגל מת); מוני-סוכנים מסמנים "חלקי" כשחברה לא-נטענה (גל-1 #130).
|
החליף את `findings_applied` (דגל מת); מוני-סוכנים מסמנים "חלקי" כשחברה לא-נטענה (גל-1 #130).
|
||||||
|
|
||||||
|
### INV-UI9: זמן-מאוחסן ב-UTC · תצוגה אנושית דטרמיניסטית ב-Asia/Jerusalem
|
||||||
|
**כלל:** **האחסון נשאר UTC** מקצה-לקצה — Postgres `TIMESTAMPTZ`, וה-API מחזיר ISO-UTC; אין נרמול-tz
|
||||||
|
בשכבת-האחסון/ה-API. **שכבת-התצוגה בלבד** ממירה, ובאופן **דטרמיניסטי**: כל חותמת-זמן אנושית מרונדרת
|
||||||
|
ב-`timeZone: "Asia/Jerusalem"` (locale `he-IL`), בלי תלות ב-tz של ה-host/קונטיינר/דפדפן. כיוון
|
||||||
|
שהקונטיינר רץ ב-UTC, פירמוט ad-hoc (`new Date(iso).toLocaleDateString("he-IL")`, `.getHours()`,
|
||||||
|
`toISOString().slice(0,10)`) מציג UTC תחת SSR (ושוב UTC בכל runtime לא-ישראלי) → drift. נעיצת
|
||||||
|
`Asia/Jerusalem` מבטיחה ש-SSR והדפדפן מסכימים. **פורמט-התצוגה (צורת התאריך/שעה) נשמר זהה — רק ה-tz
|
||||||
|
מנורמל.** מופע של [G2](00-constitution.md#inv-g2-מקור-אמת-יחיד--אין-מסלולים-מקבילים-מתפצלים)
|
||||||
|
(מפרמט-תאריך **יחיד**, אין פירמוט-זמן מקביל-מפוזר) בשכבת-התצוגה.
|
||||||
|
**מקורות:** ECMAScript Internationalization API — `Intl.DateTimeFormat` `timeZone` option
|
||||||
|
(https://tc39.es/ecma402/#datetimeformat-objects) · MDN — *Intl.DateTimeFormat* (IANA time zones)
|
||||||
|
(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat) ·
|
||||||
|
Next.js — *Rendering* (SSR משתמש בשעון-השרת אם לא ננעץ)
|
||||||
|
(https://nextjs.org/docs/app/building-your-application/rendering) | סטטוס: verified
|
||||||
|
**אכיפה:** מפרמט-תאריך יחיד ב-[web-ui/src/lib/format-date.ts](../../web-ui/src/lib/format-date.ts)
|
||||||
|
(`formatDate`/`formatDateShort`/`formatDateLong`/`formatDateTime`/`formatDateTimeFull`/`formatTime`/
|
||||||
|
`formatIsoDate`/`formatRelative` + עוזרי-Israel `getIsraelYear`/`israelDayKey`/`israelMidnightMs`/
|
||||||
|
`israelParts`), כולם נעוצים ל-`Asia/Jerusalem`; כל משטחי-ה-UI מייבאים ממנו ולא מפרמטים tz ad-hoc.
|
||||||
|
פירמוט-**מספרים** (`n.toLocaleString`) מחוץ-לתחום (אינו חותמת-זמן). **חריג מוצהר:** קלט
|
||||||
|
`<input type="datetime-local">` (בקרת-burst ב-`/operations`) הוא ערך הניתן-לכתיבה ע"י המפעיל, לא תצוגת-
|
||||||
|
מאוחסן — נשאר בנייה מקומית. **אודיט-נלווה (לא מיושם):** הגדרת `TZ=Asia/Jerusalem` בקונטיינר בטוחה רק
|
||||||
|
אם אף לוגיקה עסקית אינה תלויה בשעון-ה-process כ-UTC.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 3. כללי-עיצוב (Design Rules) — נגזרים מה-invariants
|
## 3. כללי-עיצוב (Design Rules) — נגזרים מה-invariants
|
||||||
- **SSoT ל-enums/תוויות/tones:** כל enum (CaseStatus, PracticeArea, AppealSubtype, DocType, outcome) +
|
- **SSoT ל-enums/תוויות/tones:** כל enum (CaseStatus, PracticeArea, AppealSubtype, DocType, outcome) +
|
||||||
תוויותיו + צבעיו מוגדרים **פעם אחת** ונצרכים מיבוא — לא משוכפלים בין דפים/רכיבים (מופע UI1/G2).
|
תוויותיו + צבעיו מוגדרים **פעם אחת** ונצרכים מיבוא — לא משוכפלים בין דפים/רכיבים (מופע UI1/G2).
|
||||||
- **helpers משותפים:** פירמוט-תאריך, builder ל-FormData (העלאות), רכיב-שגיאה, query-config (intervals) —
|
- **helpers משותפים:** פירמוט-תאריך (מפרמט-יחיד נעוץ-Asia/Jerusalem ב-[format-date.ts](../../web-ui/src/lib/format-date.ts),
|
||||||
משותפים, לא מועתקים.
|
INV-UI9), builder ל-FormData (העלאות), רכיב-שגיאה, query-config (intervals) — משותפים, לא מועתקים.
|
||||||
- **חוזי-טופס:** ראה INV-UI6 ([X8](X8-field-provenance.md)).
|
- **חוזי-טופס:** ראה INV-UI6 ([X8](X8-field-provenance.md)).
|
||||||
|
|
||||||
הממצאים הקונקרטיים (כפילויות, הגדרות-שגויות, redundancy) ב-[ui-audit.md](ui-audit.md); התיקון — **FU-10**.
|
הממצאים הקונקרטיים (כפילויות, הגדרות-שגויות, redundancy) ב-[ui-audit.md](ui-audit.md); התיקון — **FU-10**.
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
type ApprovalCategory,
|
type ApprovalCategory,
|
||||||
type ApprovalSeverity,
|
type ApprovalSeverity,
|
||||||
} from "@/lib/api/chair";
|
} from "@/lib/api/chair";
|
||||||
|
import { formatDateLong } from "@/lib/format-date";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* מרכז אישורים — דפנה (INV-G10).
|
* מרכז אישורים — דפנה (INV-G10).
|
||||||
@@ -35,18 +36,7 @@ const SEVERITY_RAIL: Record<ApprovalSeverity, string> = {
|
|||||||
ok: "border-s-success",
|
ok: "border-s-success",
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatDate(iso?: string | null): string {
|
const formatDate = (iso?: string | null) => formatDateLong(iso);
|
||||||
if (!iso) return "";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL", {
|
|
||||||
day: "numeric",
|
|
||||||
month: "long",
|
|
||||||
year: "numeric",
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ApprovalCard({ cat }: { cat: ApprovalCategory }) {
|
function ApprovalCard({ cat }: { cat: ApprovalCategory }) {
|
||||||
const cleared = cat.count === 0;
|
const cleared = cat.count === 0;
|
||||||
|
|||||||
@@ -28,19 +28,7 @@ import {
|
|||||||
import { useCases, useRestoreCase, type Case } from "@/lib/api/cases";
|
import { useCases, useRestoreCase, type Case } from "@/lib/api/cases";
|
||||||
import { subtypeOf } from "@/components/cases/appeal-type-bars";
|
import { subtypeOf } from "@/components/cases/appeal-type-bars";
|
||||||
import { APPEAL_SUBTYPE_LABELS, type AppealSubtype } from "@/lib/practice-area";
|
import { APPEAL_SUBTYPE_LABELS, type AppealSubtype } from "@/lib/practice-area";
|
||||||
|
import { formatDate, getIsraelYear } from "@/lib/format-date";
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// type chip styling per mockup 05 (.t-lic / .t-bet / .t-comp)
|
// type chip styling per mockup 05 (.t-lic / .t-bet / .t-comp)
|
||||||
const TYPE_CHIP: Record<string, string> = {
|
const TYPE_CHIP: Record<string, string> = {
|
||||||
@@ -177,8 +165,8 @@ export default function ArchivePage() {
|
|||||||
const set = new Set<string>();
|
const set = new Set<string>();
|
||||||
for (const c of rows) {
|
for (const c of rows) {
|
||||||
if (!c.archived_at) continue;
|
if (!c.archived_at) continue;
|
||||||
const y = new Date(c.archived_at).getFullYear();
|
const y = getIsraelYear(c.archived_at);
|
||||||
if (!Number.isNaN(y)) set.add(String(y));
|
if (y !== null) set.add(String(y));
|
||||||
}
|
}
|
||||||
return [...set].sort((a, b) => Number(b) - Number(a));
|
return [...set].sort((a, b) => Number(b) - Number(a));
|
||||||
}, [rows]);
|
}, [rows]);
|
||||||
@@ -209,7 +197,7 @@ export default function ArchivePage() {
|
|||||||
if (yearFilter !== "all") {
|
if (yearFilter !== "all") {
|
||||||
all = all.filter((r) => {
|
all = all.filter((r) => {
|
||||||
const iso = r.original.archived_at;
|
const iso = r.original.archived_at;
|
||||||
return iso != null && String(new Date(iso).getFullYear()) === yearFilter;
|
return iso != null && String(getIsraelYear(iso)) === yearFilter;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return all;
|
return all;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import {
|
|||||||
type ChairFeedback,
|
type ChairFeedback,
|
||||||
type FeedbackCategory,
|
type FeedbackCategory,
|
||||||
} from "@/lib/api/feedback";
|
} 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",
|
other: "bg-rule-soft text-ink-soft",
|
||||||
};
|
};
|
||||||
|
|
||||||
function formatDate(iso?: string | null): string {
|
const formatDate = (iso?: string | null) => formatDateLong(iso);
|
||||||
if (!iso) return "";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL", {
|
|
||||||
day: "numeric",
|
|
||||||
month: "long",
|
|
||||||
year: "numeric",
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function FeedbackCard({ fb }: { fb: ChairFeedback }) {
|
function FeedbackCard({ fb }: { fb: ChairFeedback }) {
|
||||||
const resolve = useResolveFeedback();
|
const resolve = useResolveFeedback();
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import {
|
|||||||
type SubscriptionUsage,
|
type SubscriptionUsage,
|
||||||
type UsageWindow,
|
type UsageWindow,
|
||||||
} from "@/lib/api/operations";
|
} from "@/lib/api/operations";
|
||||||
|
import { formatTime, israelParts } from "@/lib/format-date";
|
||||||
|
|
||||||
function mb(bytes: number): string {
|
function mb(bytes: number): string {
|
||||||
return `${Math.round((bytes || 0) / 1024 / 1024)}MB`;
|
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.
|
// and resumes on its own when a window resets.
|
||||||
function usageResetLabel(iso: string | null): string {
|
function usageResetLabel(iso: string | null): string {
|
||||||
if (!iso) return "—";
|
if (!iso) return "—";
|
||||||
const d = new Date(iso);
|
return `איפוס ${formatTime(iso)}`;
|
||||||
return `איפוס ${d.toLocaleTimeString("he-IL", { hour: "2-digit", minute: "2-digit" })}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function UsageMeter({ label, w }: { label: string; w?: UsageWindow | null }) {
|
function UsageMeter({ label, w }: { label: string; w?: UsageWindow | null }) {
|
||||||
@@ -195,8 +195,9 @@ function nextSaturday18(): Date {
|
|||||||
}
|
}
|
||||||
const HE_DAYS = ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"];
|
const HE_DAYS = ["א׳", "ב׳", "ג׳", "ד׳", "ה׳", "ו׳", "ש׳"];
|
||||||
function fmtDeadline(iso: string): string {
|
function fmtDeadline(iso: string): string {
|
||||||
const d = new Date(iso);
|
const p = israelParts(iso);
|
||||||
return `${HE_DAYS[d.getDay()]} ${pad2(d.getDate())}/${pad2(d.getMonth() + 1)} ${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
|
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 }) {
|
function BurstControl({ s }: { s: OpsService }) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
useRunScript,
|
useRunScript,
|
||||||
type ScriptRunResult,
|
type ScriptRunResult,
|
||||||
} from "@/lib/api/scripts";
|
} from "@/lib/api/scripts";
|
||||||
|
import { formatDateLong } from "@/lib/format-date";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* /scripts — catalog of everything under scripts/, rendered as the
|
* /scripts — catalog of everything under scripts/, rendered as the
|
||||||
@@ -354,11 +355,7 @@ export default function ScriptsPage() {
|
|||||||
|
|
||||||
const lastModified =
|
const lastModified =
|
||||||
data?.last_modified != null
|
data?.last_modified != null
|
||||||
? new Date(data.last_modified * 1000).toLocaleDateString("he-IL", {
|
? formatDateLong(data.last_modified * 1000)
|
||||||
year: "numeric",
|
|
||||||
month: "long",
|
|
||||||
day: "numeric",
|
|
||||||
})
|
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
const giteaBase = data?.gitea_url ?? null;
|
const giteaBase = data?.gitea_url ?? null;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
type DriftEntry,
|
type DriftEntry,
|
||||||
type PaperclipAgent,
|
type PaperclipAgent,
|
||||||
} from "@/lib/api/paperclip-agents";
|
} from "@/lib/api/paperclip-agents";
|
||||||
|
import { formatDateShort } from "@/lib/format-date";
|
||||||
|
|
||||||
const ROLE_LABEL: Record<string, string> = {
|
const ROLE_LABEL: Record<string, string> = {
|
||||||
ceo: "CEO",
|
ceo: "CEO",
|
||||||
@@ -211,7 +212,7 @@ function PairCard({ pair }: { pair: AgentPair }) {
|
|||||||
</Button>
|
</Button>
|
||||||
{pair.master?.updated_at && (
|
{pair.master?.updated_at && (
|
||||||
<span className="text-[0.7rem] text-ink-light">
|
<span className="text-[0.7rem] text-ink-light">
|
||||||
עודכן: {new Date(pair.master.updated_at).toLocaleDateString("he-IL")}
|
עודכן: {formatDateShort(pair.master.updated_at)}
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
} from "@/components/ui/table";
|
} from "@/components/ui/table";
|
||||||
import { useSkills, type Skill } from "@/lib/api/skills";
|
import { useSkills, type Skill } from "@/lib/api/skills";
|
||||||
|
import { formatIsoDate } from "@/lib/format-date";
|
||||||
|
|
||||||
function formatChars(skill: Skill): string {
|
function formatChars(skill: Skill): string {
|
||||||
// Mockup column = "גודל (תווים)" — the DB markdown char count, grouped.
|
// Mockup column = "גודל (תווים)" — the DB markdown char count, grouped.
|
||||||
@@ -21,13 +22,8 @@ function formatChars(skill: Skill): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatUpdated(iso: string | null): string {
|
function formatUpdated(iso: string | null): string {
|
||||||
if (!iso) return "—";
|
// ISO-style date to match the mockup (2026-06-09), tabular — Israel-time day.
|
||||||
try {
|
return formatIsoDate(iso);
|
||||||
// ISO-style date to match the mockup (2026-06-09), tabular.
|
|
||||||
return new Date(iso).toISOString().slice(0, 10);
|
|
||||||
} catch {
|
|
||||||
return "—";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import type {
|
|||||||
InteractionTask,
|
InteractionTask,
|
||||||
PaperclipComment,
|
PaperclipComment,
|
||||||
} from "@/lib/api/agents";
|
} from "@/lib/api/agents";
|
||||||
|
import { formatRelative } from "@/lib/format-date";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import {
|
import {
|
||||||
Bot,
|
Bot,
|
||||||
@@ -83,15 +84,7 @@ function issueStatusLabel(status: string) {
|
|||||||
/* ── Time formatting ─────────────────────────────────────────── */
|
/* ── Time formatting ─────────────────────────────────────────── */
|
||||||
|
|
||||||
function timeAgo(iso: string | null): string {
|
function timeAgo(iso: string | null): string {
|
||||||
if (!iso) return "";
|
return formatRelative(iso, { units: "short", fallback: "" });
|
||||||
const diff = Date.now() - new Date(iso).getTime();
|
|
||||||
const mins = Math.floor(diff / 60_000);
|
|
||||||
if (mins < 1) return "עכשיו";
|
|
||||||
if (mins < 60) return `לפני ${mins} דק׳`;
|
|
||||||
const hours = Math.floor(mins / 60);
|
|
||||||
if (hours < 24) return `לפני ${hours} שע׳`;
|
|
||||||
const days = Math.floor(hours / 24);
|
|
||||||
return `לפני ${days} ימים`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Issue identifier → find matching identifier ─────────────── */
|
/* ── Issue identifier → find matching identifier ─────────────── */
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import Link from "next/link";
|
|||||||
import { Loader2, CheckCircle2, Clock } from "lucide-react";
|
import { Loader2, CheckCircle2, Clock } from "lucide-react";
|
||||||
import { useAgentActivity } from "@/lib/api/agents";
|
import { useAgentActivity } from "@/lib/api/agents";
|
||||||
import type { PaperclipIssue } from "@/lib/api/agents";
|
import type { PaperclipIssue } from "@/lib/api/agents";
|
||||||
|
import { formatRelative } from "@/lib/format-date";
|
||||||
|
|
||||||
const STATUS_DOT: Record<string, string> = {
|
const STATUS_DOT: Record<string, string> = {
|
||||||
in_progress: "bg-gold",
|
in_progress: "bg-gold",
|
||||||
@@ -22,13 +23,7 @@ const STATUS_LABEL: Record<string, string> = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function timeAgo(iso: string | null): string {
|
function timeAgo(iso: string | null): string {
|
||||||
if (!iso) return "—";
|
return formatRelative(iso, { units: "tight", fallback: "—" });
|
||||||
const diffMs = Date.now() - new Date(iso).getTime();
|
|
||||||
const m = Math.floor(diffMs / 60_000);
|
|
||||||
if (m < 60) return `לפני ${m}ד'`;
|
|
||||||
const h = Math.floor(m / 60);
|
|
||||||
if (h < 24) return `לפני ${h}ש'`;
|
|
||||||
return `לפני ${Math.floor(h / 24)} ימים`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function IssueRow({ issue }: { issue: PaperclipIssue }) {
|
function IssueRow({ issue }: { issue: PaperclipIssue }) {
|
||||||
|
|||||||
@@ -10,21 +10,9 @@ import {
|
|||||||
APPEAL_SUBTYPE_LABELS,
|
APPEAL_SUBTYPE_LABELS,
|
||||||
isBlamSubtype,
|
isBlamSubtype,
|
||||||
} from "@/lib/practice-area";
|
} from "@/lib/practice-area";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import type { CaseDetail } from "@/lib/api/cases";
|
import type { CaseDetail } from "@/lib/api/cases";
|
||||||
|
|
||||||
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 ?? "—";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function partiesLine(data?: CaseDetail): string | null {
|
function partiesLine(data?: CaseDetail): string | null {
|
||||||
const appellant = data?.appellants?.filter(Boolean) ?? [];
|
const appellant = data?.appellants?.filter(Boolean) ?? [];
|
||||||
const respondent = data?.respondents?.filter(Boolean) ?? [];
|
const respondent = data?.respondents?.filter(Boolean) ?? [];
|
||||||
|
|||||||
@@ -24,32 +24,16 @@ import {
|
|||||||
import { StatusBadge } from "@/components/cases/status-badge";
|
import { StatusBadge } from "@/components/cases/status-badge";
|
||||||
import { isBlamSubtype } from "@/lib/practice-area";
|
import { isBlamSubtype } from "@/lib/practice-area";
|
||||||
import type { Case } from "@/lib/api/cases";
|
import type { Case } from "@/lib/api/cases";
|
||||||
|
import { formatDate, israelMidnightMs, todayIsraelMidnightMs } from "@/lib/format-date";
|
||||||
|
|
||||||
function formatDate(iso?: string) {
|
/** Midnight today in Israel time, in ms — pivot between an upcoming and a past hearing. */
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL", {
|
|
||||||
day: "2-digit",
|
|
||||||
month: "2-digit",
|
|
||||||
year: "numeric",
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Midnight today, in ms — the pivot between an upcoming and a past hearing. */
|
|
||||||
function startOfToday() {
|
function startOfToday() {
|
||||||
const d = new Date();
|
return todayIsraelMidnightMs();
|
||||||
d.setHours(0, 0, 0, 0);
|
|
||||||
return d.getTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Day-precision ms for a hearing date, or null when absent/unparseable. */
|
/** Day-precision ms (Israel time) for a hearing date, or null when absent/unparseable. */
|
||||||
function hearingMs(iso?: string | null): number | null {
|
function hearingMs(iso?: string | null): number | null {
|
||||||
if (!iso) return null;
|
return israelMidnightMs(iso);
|
||||||
const t = new Date(iso).setHours(0, 0, 0, 0);
|
|
||||||
return Number.isNaN(t) ? null : t;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type HearingClass = "soon" | "upcoming" | "past" | "none";
|
type HearingClass = "soon" | "upcoming" | "past" | "none";
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import {
|
|||||||
type BlockStatus,
|
type BlockStatus,
|
||||||
} from "@/lib/api/decision-blocks";
|
} from "@/lib/api/decision-blocks";
|
||||||
import { BLOCK_LABELS } from "@/lib/api/feedback";
|
import { BLOCK_LABELS } from "@/lib/api/feedback";
|
||||||
|
import { formatTime } from "@/lib/format-date";
|
||||||
import { AlertTriangle, Pencil, FileText } from "lucide-react";
|
import { AlertTriangle, Pencil, FileText } from "lucide-react";
|
||||||
|
|
||||||
/* ── status badge styling ─────────────────────────────── */
|
/* ── status badge styling ─────────────────────────────── */
|
||||||
@@ -233,10 +234,7 @@ function SaveIndicator({ state }: { state: SaveState }) {
|
|||||||
return <span className="text-[0.72rem] text-ink-muted">⏳ שומר…</span>;
|
return <span className="text-[0.72rem] text-ink-muted">⏳ שומר…</span>;
|
||||||
}
|
}
|
||||||
if (state.kind === "saved") {
|
if (state.kind === "saved") {
|
||||||
const time = state.at.toLocaleTimeString("he-IL", {
|
const time = formatTime(state.at);
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
});
|
|
||||||
return <span className="text-[0.72rem] text-success">✓ נשמר {time}</span>;
|
return <span className="text-[0.72rem] text-success">✓ נשמר {time}</span>;
|
||||||
}
|
}
|
||||||
return <span className="text-[0.72rem] text-danger">⚠ {state.message}</span>;
|
return <span className="text-[0.72rem] text-danger">⚠ {state.message}</span>;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import { apiRequest } from "@/lib/api/client";
|
|||||||
import { casesKeys } from "@/lib/api/cases";
|
import { casesKeys } from "@/lib/api/cases";
|
||||||
import type { CaseDetail, CaseDocument } from "@/lib/api/cases";
|
import type { CaseDetail, CaseDocument } from "@/lib/api/cases";
|
||||||
import { DocumentTypeEditor } from "@/components/cases/document-type-editor";
|
import { DocumentTypeEditor } from "@/components/cases/document-type-editor";
|
||||||
|
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Document list for the case detail "מסמכים" tab. Uses the real document
|
* Document list for the case detail "מסמכים" tab. Uses the real document
|
||||||
@@ -76,15 +77,6 @@ function StatusIcon({ status }: { status: string }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(iso: string) {
|
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL");
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function filenameFromPath(path: string): string {
|
function filenameFromPath(path: string): string {
|
||||||
const parts = path.split("/");
|
const parts = path.split("/");
|
||||||
return parts[parts.length - 1] || path;
|
return parts[parts.length - 1] || path;
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import {
|
|||||||
import { useCaseCitations } from "@/lib/api/citations";
|
import { useCaseCitations } from "@/lib/api/citations";
|
||||||
import { learningKeys } from "@/lib/api/learning";
|
import { learningKeys } from "@/lib/api/learning";
|
||||||
import { LearningStatusBadges } from "@/components/cases/learning-status-badges";
|
import { LearningStatusBadges } from "@/components/cases/learning-status-badges";
|
||||||
|
import { formatDateTime, formatDateShort } from "@/lib/format-date";
|
||||||
import type { CaseStatus } from "@/lib/api/cases";
|
import type { CaseStatus } from "@/lib/api/cases";
|
||||||
import { toast } from "sonner";
|
import { toast } from "sonner";
|
||||||
import {
|
import {
|
||||||
@@ -72,13 +73,7 @@ function formatSize(bytes: number): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function formatDate(epoch: number): string {
|
function formatDate(epoch: number): string {
|
||||||
return new Date(epoch * 1000).toLocaleDateString("he-IL", {
|
return formatDateTime(epoch * 1000);
|
||||||
day: "numeric",
|
|
||||||
month: "short",
|
|
||||||
year: "numeric",
|
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ── Main component ─────────────────────────────────── */
|
/* ── Main component ─────────────────────────────────── */
|
||||||
@@ -568,9 +563,7 @@ export function DraftsPanel({
|
|||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
<span className="text-[0.65rem] text-ink-muted me-auto">
|
<span className="text-[0.65rem] text-ink-muted me-auto">
|
||||||
{fb.created_at
|
{fb.created_at ? formatDateShort(fb.created_at) : ""}
|
||||||
? new Date(fb.created_at).toLocaleDateString("he-IL")
|
|
||||||
: ""}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm leading-relaxed">{fb.feedback_text}</p>
|
<p className="text-sm leading-relaxed">{fb.feedback_text}</p>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { StatusChanger } from "@/components/cases/status-changer";
|
|||||||
import { StatusGuide } from "@/components/cases/status-guide";
|
import { StatusGuide } from "@/components/cases/status-guide";
|
||||||
import { AgentStatusWidget } from "@/components/cases/agent-status-widget";
|
import { AgentStatusWidget } from "@/components/cases/agent-status-widget";
|
||||||
import { expectedOutcomes } from "@/lib/schemas/case";
|
import { expectedOutcomes } from "@/lib/schemas/case";
|
||||||
|
import { formatDate } from "@/lib/format-date";
|
||||||
import type { CaseDetail } from "@/lib/api/cases";
|
import type { CaseDetail } from "@/lib/api/cases";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -21,19 +22,6 @@ const EXPECTED_OUTCOME_LABELS: Record<string, string> = Object.fromEntries(
|
|||||||
expectedOutcomes.map((o) => [o.value, o.label]),
|
expectedOutcomes.map((o) => [o.value, o.label]),
|
||||||
);
|
);
|
||||||
|
|
||||||
function formatDate(iso?: string | null): string {
|
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL", {
|
|
||||||
day: "2-digit",
|
|
||||||
month: "2-digit",
|
|
||||||
year: "numeric",
|
|
||||||
});
|
|
||||||
} catch {
|
|
||||||
return iso ?? "—";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function phaseIndexOf(status?: CaseStatus): number {
|
function phaseIndexOf(status?: CaseStatus): number {
|
||||||
if (!status) return -1;
|
if (!status) return -1;
|
||||||
return PHASES.findIndex((p) => p.statuses.includes(status));
|
return PHASES.findIndex((p) => p.statuses.includes(status));
|
||||||
|
|||||||
@@ -2,17 +2,7 @@
|
|||||||
|
|
||||||
import { useGitStatus } from "@/lib/api/cases";
|
import { useGitStatus } from "@/lib/api/cases";
|
||||||
import { CheckCircle2, AlertCircle, Clock, CloudOff } from "lucide-react";
|
import { CheckCircle2, AlertCircle, Clock, CloudOff } from "lucide-react";
|
||||||
|
import { formatRelative } from "@/lib/format-date";
|
||||||
function formatRelative(iso: string): string {
|
|
||||||
const diff = Date.now() - new Date(iso).getTime();
|
|
||||||
const mins = Math.floor(diff / 60_000);
|
|
||||||
if (mins < 1) return "עכשיו";
|
|
||||||
if (mins < 60) return `לפני ${mins} דק׳`;
|
|
||||||
const hours = Math.floor(mins / 60);
|
|
||||||
if (hours < 24) return `לפני ${hours} שע׳`;
|
|
||||||
const days = Math.floor(hours / 24);
|
|
||||||
return `לפני ${days} ימים`;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function SyncIndicator({ caseNumber }: { caseNumber?: string }) {
|
export function SyncIndicator({ caseNumber }: { caseNumber?: string }) {
|
||||||
const { data, isLoading } = useGitStatus(caseNumber);
|
const { data, isLoading } = useGitStatus(caseNumber);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import { useEffect, useRef, useState } from "react";
|
import { useEffect, useRef, useState } from "react";
|
||||||
import { useSaveChairPosition } from "@/lib/api/research";
|
import { useSaveChairPosition } from "@/lib/api/research";
|
||||||
|
import { formatTime } from "@/lib/format-date";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chair-position editor for a single threshold claim or issue.
|
* Chair-position editor for a single threshold claim or issue.
|
||||||
@@ -87,10 +88,7 @@ function SaveIndicator({ state }: { state: SaveState }) {
|
|||||||
return <span className="text-[0.72rem] text-ink-muted">⏳ שומר…</span>;
|
return <span className="text-[0.72rem] text-ink-muted">⏳ שומר…</span>;
|
||||||
}
|
}
|
||||||
if (state.kind === "saved") {
|
if (state.kind === "saved") {
|
||||||
const time = state.at.toLocaleTimeString("he-IL", {
|
const time = formatTime(state.at);
|
||||||
hour: "2-digit",
|
|
||||||
minute: "2-digit",
|
|
||||||
});
|
|
||||||
return <span className="text-[0.72rem] text-success">✓ נשמר {time}</span>;
|
return <span className="text-[0.72rem] text-success">✓ נשמר {time}</span>;
|
||||||
}
|
}
|
||||||
return <span className="text-[0.72rem] text-danger">⚠ {state.message}</span>;
|
return <span className="text-[0.72rem] text-danger">⚠ {state.message}</span>;
|
||||||
|
|||||||
@@ -5,15 +5,7 @@ import type { ReactNode } from "react";
|
|||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { practiceAreaLabel } from "@/components/precedents/practice-area";
|
import { practiceAreaLabel } from "@/components/precedents/practice-area";
|
||||||
import type { Digest } from "@/lib/api/digests";
|
import type { Digest } from "@/lib/api/digests";
|
||||||
|
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||||
function formatDate(iso: string | null) {
|
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL");
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Presentational card for a single digest ("כל יום" radar entry).
|
* Presentational card for a single digest ("כל יום" radar entry).
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
} from "@/components/ui/select";
|
} from "@/components/ui/select";
|
||||||
import type { GraphFacets } from "@/lib/api/graph";
|
import type { GraphFacets } from "@/lib/api/graph";
|
||||||
import type { ColorBy, SizeBy } from "@/components/graph/graph-canvas";
|
import type { ColorBy, SizeBy } from "@/components/graph/graph-canvas";
|
||||||
|
import { getIsraelYear } from "@/lib/format-date";
|
||||||
|
|
||||||
export type GraphControls = {
|
export type GraphControls = {
|
||||||
practiceArea: string;
|
practiceArea: string;
|
||||||
@@ -51,7 +52,7 @@ const ALL = "__all__";
|
|||||||
// Floor covers the oldest dated precedent in the corpus (currently ע"א 725/81 →
|
// Floor covers the oldest dated precedent in the corpus (currently ע"א 725/81 →
|
||||||
// 1982); ceiling tracks the current year so the range never ages out.
|
// 1982); ceiling tracks the current year so the range never ages out.
|
||||||
const YEAR_FLOOR = 1980;
|
const YEAR_FLOOR = 1980;
|
||||||
const CURRENT_YEAR = new Date().getFullYear();
|
const CURRENT_YEAR = getIsraelYear(new Date()) ?? new Date().getFullYear();
|
||||||
const YEARS = Array.from(
|
const YEARS = Array.from(
|
||||||
{ length: CURRENT_YEAR - YEAR_FLOOR + 1 },
|
{ length: CURRENT_YEAR - YEAR_FLOOR + 1 },
|
||||||
(_, i) => CURRENT_YEAR - i,
|
(_, i) => CURRENT_YEAR - i,
|
||||||
|
|||||||
@@ -20,15 +20,7 @@ import {
|
|||||||
type MissingPrecedentStatus,
|
type MissingPrecedentStatus,
|
||||||
} from "@/lib/api/missing-precedents";
|
} from "@/lib/api/missing-precedents";
|
||||||
import { MissingPrecedentDetailDrawer } from "./missing-precedent-detail-drawer";
|
import { MissingPrecedentDetailDrawer } from "./missing-precedent-detail-drawer";
|
||||||
|
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||||
function formatDate(iso: string | null) {
|
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL");
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Status chip — mockup 09 tones (open=warn, uploaded=info, closed=success,
|
/** Status chip — mockup 09 tones (open=warn, uploaded=info, closed=success,
|
||||||
* irrelevant=muted). Pill-shaped, whitespace-nowrap. */
|
* irrelevant=muted). Pill-shaped, whitespace-nowrap. */
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { Card, CardContent } from "@/components/ui/card";
|
|||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { useDiagnostics, type DiagDoc } from "@/lib/api/system";
|
import { useDiagnostics, type DiagDoc } from "@/lib/api/system";
|
||||||
|
import { formatDateShort, formatRelative } from "@/lib/format-date";
|
||||||
|
|
||||||
const TABLE_LABELS: Record<string, string> = {
|
const TABLE_LABELS: Record<string, string> = {
|
||||||
cases: "תיקים",
|
cases: "תיקים",
|
||||||
@@ -25,16 +26,10 @@ const TABLE_LABELS: Record<string, string> = {
|
|||||||
|
|
||||||
function formatRelativeTime(iso: string | null) {
|
function formatRelativeTime(iso: string | null) {
|
||||||
if (!iso) return "—";
|
if (!iso) return "—";
|
||||||
const then = new Date(iso);
|
const min = Math.floor((Date.now() - new Date(iso).getTime()) / 60000);
|
||||||
const diffMs = Date.now() - then.getTime();
|
// Past 30 days, fall back to an absolute Israel-time date.
|
||||||
const min = Math.floor(diffMs / 60000);
|
if (min >= 30 * 24 * 60) return formatDateShort(iso);
|
||||||
if (min < 1) return "עכשיו";
|
return formatRelative(iso, { units: "long" });
|
||||||
if (min < 60) return `לפני ${min} דקות`;
|
|
||||||
const hr = Math.floor(min / 60);
|
|
||||||
if (hr < 24) return `לפני ${hr} שעות`;
|
|
||||||
const days = Math.floor(hr / 24);
|
|
||||||
if (days < 30) return `לפני ${days} ימים`;
|
|
||||||
return then.toLocaleDateString("he-IL");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DocRow({ doc, tone }: { doc: DiagDoc; tone: "danger" | "warn" }) {
|
function DocRow({ doc, tone }: { doc: DiagDoc; tone: "danger" | "warn" }) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import {
|
|||||||
type Halacha, type CanonicalInstance,
|
type Halacha, type CanonicalInstance,
|
||||||
} from "@/lib/api/precedent-library";
|
} from "@/lib/api/precedent-library";
|
||||||
import { AuthorityBadge, ruleTypeLabel } from "./halacha-meta";
|
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. */
|
/** #81 strict-rubric flags — why an item was held back from auto-approval. */
|
||||||
const QUALITY_FLAG_LABELS: Record<string, string> = {
|
const QUALITY_FLAG_LABELS: Record<string, string> = {
|
||||||
@@ -28,15 +29,6 @@ const QUALITY_FLAG_LABELS: Record<string, string> = {
|
|||||||
nevo_preamble_leak: "דליפת רציו נבו",
|
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. */
|
/* Strip Unicode bidi marks that render as zero-width but shift visual position. */
|
||||||
function cleanCitation(s: string | null | undefined): string {
|
function cleanCitation(s: string | null | undefined): string {
|
||||||
if (!s) return "—";
|
if (!s) return "—";
|
||||||
|
|||||||
@@ -31,15 +31,7 @@ import {
|
|||||||
FormattedCitation,
|
FormattedCitation,
|
||||||
CitationCopyButton,
|
CitationCopyButton,
|
||||||
} from "./formatted-citation";
|
} from "./formatted-citation";
|
||||||
|
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||||
function formatDate(iso: string | null) {
|
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL");
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cleanCitation(s: string | null | undefined): string {
|
function cleanCitation(s: string | null | undefined): string {
|
||||||
if (!s) return "—";
|
if (!s) return "—";
|
||||||
|
|||||||
@@ -14,15 +14,7 @@ import {
|
|||||||
} from "@/lib/api/precedent-library";
|
} from "@/lib/api/precedent-library";
|
||||||
import { PRACTICE_AREAS, PRECEDENT_LEVELS } from "./practice-area";
|
import { PRACTICE_AREAS, PRECEDENT_LEVELS } from "./practice-area";
|
||||||
import { AuthorityBadge } from "./halacha-meta";
|
import { AuthorityBadge } from "./halacha-meta";
|
||||||
|
import { formatDateShort as formatDate } from "@/lib/format-date";
|
||||||
function formatDate(iso: string | null) {
|
|
||||||
if (!iso) return "—";
|
|
||||||
try {
|
|
||||||
return new Date(iso).toLocaleDateString("he-IL");
|
|
||||||
} catch {
|
|
||||||
return iso;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Score chip — boxed, gold-deep, tabular (mockup 07 `.score`). Sits at the
|
/** 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. */
|
* 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";
|
} from "@/lib/api/precedent-library";
|
||||||
import { ApiError } from "@/lib/api/client";
|
import { ApiError } from "@/lib/api/client";
|
||||||
import { useProgress } from "@/lib/api/documents";
|
import { useProgress } from "@/lib/api/documents";
|
||||||
|
import { formatDateShort } from "@/lib/format-date";
|
||||||
import {
|
import {
|
||||||
PRACTICE_AREAS, PRECEDENT_LEVELS, SOURCE_TYPES,
|
PRACTICE_AREAS, PRECEDENT_LEVELS, SOURCE_TYPES,
|
||||||
} from "./practice-area";
|
} from "./practice-area";
|
||||||
@@ -192,7 +193,7 @@ export function PrecedentUploadSheet({ open, onOpenChange }: Props) {
|
|||||||
{conflict.citation}
|
{conflict.citation}
|
||||||
{conflict.case_name && ` — ${conflict.case_name}`}
|
{conflict.case_name && ` — ${conflict.case_name}`}
|
||||||
{conflict.court && ` · ${conflict.court}`}
|
{conflict.court && ` · ${conflict.court}`}
|
||||||
{conflict.date && ` · ${new Date(conflict.date).toLocaleDateString("he-IL")}`}
|
{conflict.date && ` · ${formatDateShort(conflict.date)}`}
|
||||||
</p>
|
</p>
|
||||||
{conflict.halacha_extraction_status && (
|
{conflict.halacha_extraction_status && (
|
||||||
<p className="text-danger/60 text-[0.72rem]">
|
<p className="text-danger/60 text-[0.72rem]">
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import {
|
|||||||
useDeleteChat,
|
useDeleteChat,
|
||||||
type ChatMessage,
|
type ChatMessage,
|
||||||
} from "@/lib/api/training";
|
} from "@/lib/api/training";
|
||||||
|
import { formatDateShort } from "@/lib/format-date";
|
||||||
import { useQueryClient } from "@tanstack/react-query";
|
import { useQueryClient } from "@tanstack/react-query";
|
||||||
|
|
||||||
export function ChatPanel() {
|
export function ChatPanel() {
|
||||||
@@ -200,7 +201,7 @@ function ConversationsSidebar({
|
|||||||
<span className="tabular-nums">{c.message_count}</span>
|
<span className="tabular-nums">{c.message_count}</span>
|
||||||
<MessageSquare className="w-3 h-3" />
|
<MessageSquare className="w-3 h-3" />
|
||||||
<span className="grow text-end">
|
<span className="grow text-end">
|
||||||
{new Date(c.last_message_at).toLocaleDateString("he-IL")}
|
{formatDateShort(c.last_message_at)}
|
||||||
</span>
|
</span>
|
||||||
<button
|
<button
|
||||||
onClick={(e) => { e.stopPropagation(); onDelete(c.id); }}
|
onClick={(e) => { e.stopPropagation(); onDelete(c.id); }}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import { Badge } from "@/components/ui/badge";
|
|||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
import { useCorpus, useDeleteCorpusEntry, type CorpusDecision } from "@/lib/api/training";
|
import { useCorpus, useDeleteCorpusEntry, type CorpusDecision } from "@/lib/api/training";
|
||||||
import { CorpusDetailDrawer } from "./corpus-detail-drawer";
|
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.
|
* 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`;
|
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({
|
function Row({
|
||||||
item, onOpen,
|
item, onOpen,
|
||||||
}: { item: CorpusDecision; onOpen: () => void }) {
|
}: { item: CorpusDecision; onOpen: () => void }) {
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import { Skeleton } from "@/components/ui/skeleton";
|
|||||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||||
import { Markdown } from "@/components/ui/markdown";
|
import { Markdown } from "@/components/ui/markdown";
|
||||||
|
import { formatDateShort, formatDateTimeFull } from "@/lib/format-date";
|
||||||
import {
|
import {
|
||||||
useCuratorPrompt,
|
useCuratorPrompt,
|
||||||
useCuratorStats,
|
useCuratorStats,
|
||||||
@@ -256,7 +257,7 @@ function RecentFindings() {
|
|||||||
)}
|
)}
|
||||||
<span className="grow text-ink-muted text-end">
|
<span className="grow text-ink-muted text-end">
|
||||||
<Clock className="w-3 h-3 inline me-1" />
|
<Clock className="w-3 h-3 inline me-1" />
|
||||||
{new Date(f.created_at).toLocaleDateString("he-IL")}
|
{formatDateShort(f.created_at)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<p className="text-sm text-ink leading-relaxed">{f.lesson_text}</p>
|
<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>
|
<h3 className="text-navy font-semibold">{data.filename}</h3>
|
||||||
<p className="text-[0.72rem] text-ink-muted">
|
<p className="text-[0.72rem] text-ink-muted">
|
||||||
{data.bytes.toLocaleString("he-IL")} בייטים ·
|
{data.bytes.toLocaleString("he-IL")} בייטים ·
|
||||||
עודכן: {new Date(data.last_modified * 1000).toLocaleString("he-IL")}
|
עודכן: {formatDateTimeFull(data.last_modified * 1000)}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<Button asChild variant="outline" size="sm">
|
<Button asChild variant="outline" size="sm">
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import {
|
|||||||
useReconciliationLedger, useStyleDistance, usePairDetail, usePromoteLearning,
|
useReconciliationLedger, useStyleDistance, usePairDetail, usePromoteLearning,
|
||||||
type DraftFinalPair,
|
type DraftFinalPair,
|
||||||
} from "@/lib/api/learning";
|
} from "@/lib/api/learning";
|
||||||
|
import { formatDateShort as fmtDate } from "@/lib/format-date";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* /training "למידה" tab (T6/T13) — the reconciliation ledger (INV-LRN4): every
|
* /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",
|
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 }) {
|
function StyleDistanceDetail({ caseNumber }: { caseNumber: string }) {
|
||||||
const { data, isPending, error } = useStyleDistance(caseNumber);
|
const { data, isPending, error } = useStyleDistance(caseNumber);
|
||||||
if (isPending) return <Loader2 className="w-4 h-4 animate-spin text-ink-muted" />;
|
if (isPending) return <Loader2 className="w-4 h-4 animate-spin text-ink-muted" />;
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import {
|
|||||||
usePatchLesson,
|
usePatchLesson,
|
||||||
type DecisionLesson,
|
type DecisionLesson,
|
||||||
} from "@/lib/api/training";
|
} from "@/lib/api/training";
|
||||||
|
import { formatDateShort } from "@/lib/format-date";
|
||||||
|
|
||||||
const CATEGORIES = [
|
const CATEGORIES = [
|
||||||
{ value: "general", label: "כללי" },
|
{ value: "general", label: "כללי" },
|
||||||
@@ -224,7 +225,7 @@ function LessonItem({
|
|||||||
{reviewBadge.label}
|
{reviewBadge.label}
|
||||||
</Badge>
|
</Badge>
|
||||||
<span className="grow text-ink-muted tabular-nums">
|
<span className="grow text-ink-muted tabular-nums">
|
||||||
{new Date(lesson.created_at).toLocaleDateString("he-IL")}
|
{formatDateShort(lesson.created_at)}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
296
web-ui/src/lib/format-date.ts
Normal file
296
web-ui/src/lib/format-date.ts
Normal file
@@ -0,0 +1,296 @@
|
|||||||
|
/**
|
||||||
|
* Central date/time formatting — pinned to Israel time (Asia/Jerusalem).
|
||||||
|
*
|
||||||
|
* WHY THIS EXISTS (INV-UI9 / G2):
|
||||||
|
* Storage stays UTC end-to-end (Postgres TIMESTAMPTZ, API returns ISO-UTC).
|
||||||
|
* Only the *display* layer is localized, and it is localized **deterministically**:
|
||||||
|
* every human-facing timestamp renders in `Asia/Jerusalem`, regardless of the
|
||||||
|
* host/container/browser timezone. The legal-ai container runs in UTC, so an
|
||||||
|
* ad-hoc `new Date(iso).toLocaleDateString("he-IL")` shows UTC under SSR (and
|
||||||
|
* UTC again on any non-Israel runtime) — that drift is exactly what this module
|
||||||
|
* removes. Pinning `timeZone: "Asia/Jerusalem"` makes SSR and the browser agree.
|
||||||
|
*
|
||||||
|
* This is the ONE date formatter for the UI. Do not format timestamps ad-hoc
|
||||||
|
* with `new Date(...).toLocaleDateString(...)` / `.toLocaleString(...)` /
|
||||||
|
* `.getHours()` rendering elsewhere — route through these helpers so the tz is
|
||||||
|
* always Israel and nothing drifts.
|
||||||
|
*
|
||||||
|
* Number formatting (e.g. `n.toLocaleString("he-IL")`) is NOT a timestamp and is
|
||||||
|
* intentionally out of scope here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
const TZ = "Asia/Jerusalem";
|
||||||
|
const LOCALE = "he-IL";
|
||||||
|
|
||||||
|
/** Coerce an ISO string / epoch-ms / Date into a valid Date, or null. */
|
||||||
|
function toDate(value: string | number | Date | null | undefined): Date | null {
|
||||||
|
if (value == null) return null;
|
||||||
|
const d = value instanceof Date ? value : new Date(value);
|
||||||
|
return Number.isNaN(d.getTime()) ? null : d;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date only — `dd/MM/yyyy` in Israel time (e.g. "30/06/2026").
|
||||||
|
* Matches the prior `toLocaleDateString("he-IL", {day,month:"2-digit",year:"numeric"})`.
|
||||||
|
*/
|
||||||
|
export function formatDate(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "—",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
return new Intl.DateTimeFormat(LOCALE, {
|
||||||
|
timeZone: TZ,
|
||||||
|
day: "2-digit",
|
||||||
|
month: "2-digit",
|
||||||
|
year: "numeric",
|
||||||
|
}).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date only — long month form (e.g. "30 ביוני 2026") in Israel time.
|
||||||
|
* Matches the prior `toLocaleDateString("he-IL", {day:"numeric",month:"long",year:"numeric"})`.
|
||||||
|
*/
|
||||||
|
export function formatDateLong(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
return new Intl.DateTimeFormat(LOCALE, {
|
||||||
|
timeZone: TZ,
|
||||||
|
day: "numeric",
|
||||||
|
month: "long",
|
||||||
|
year: "numeric",
|
||||||
|
}).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date only — short form, locale default (e.g. "30.6.2026") in Israel time.
|
||||||
|
* Matches the prior bare `toLocaleDateString("he-IL")`.
|
||||||
|
*/
|
||||||
|
export function formatDateShort(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "—",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
return new Intl.DateTimeFormat(LOCALE, { timeZone: TZ }).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date + time — `d בMMM yyyy, HH:mm` style in Israel time.
|
||||||
|
* Matches the prior `{day:"numeric",month:"short",year:"numeric",hour,minute}`.
|
||||||
|
*/
|
||||||
|
export function formatDateTime(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "—",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
return new Intl.DateTimeFormat(LOCALE, {
|
||||||
|
timeZone: TZ,
|
||||||
|
day: "numeric",
|
||||||
|
month: "short",
|
||||||
|
year: "numeric",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
}).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Full date + time — locale default with time, Israel time.
|
||||||
|
* Matches the prior bare `toLocaleString("he-IL")`.
|
||||||
|
*/
|
||||||
|
export function formatDateTimeFull(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "—",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
return new Intl.DateTimeFormat(LOCALE, {
|
||||||
|
timeZone: TZ,
|
||||||
|
dateStyle: "short",
|
||||||
|
timeStyle: "short",
|
||||||
|
}).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Time only — `HH:mm` in Israel time (e.g. "14:05").
|
||||||
|
* Matches the prior `toLocaleTimeString("he-IL", {hour,minute})`.
|
||||||
|
*/
|
||||||
|
export function formatTime(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "—",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
return new Intl.DateTimeFormat(LOCALE, {
|
||||||
|
timeZone: TZ,
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
}).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISO calendar date `YYYY-MM-DD` for the Israel-time day of the instant.
|
||||||
|
* Deterministic replacement for `new Date(iso).toISOString().slice(0,10)`,
|
||||||
|
* which yields the UTC day (off-by-one near midnight Israel time).
|
||||||
|
*/
|
||||||
|
export function formatIsoDate(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
fallback = "—",
|
||||||
|
): string {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
// en-CA's short date is ISO-shaped (YYYY-MM-DD); pin the tz so it's the Israel day.
|
||||||
|
return new Intl.DateTimeFormat("en-CA", {
|
||||||
|
timeZone: TZ,
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
}).format(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The calendar year (number) of the Israel-time day for an instant.
|
||||||
|
* Deterministic replacement for `new Date(iso).getFullYear()` (which uses the
|
||||||
|
* runtime tz). Returns null when the value is absent/unparseable.
|
||||||
|
*/
|
||||||
|
export function getIsraelYear(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
): number | null {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return null;
|
||||||
|
const y = new Intl.DateTimeFormat("en-CA", { timeZone: TZ, year: "numeric" }).format(d);
|
||||||
|
const n = Number(y);
|
||||||
|
return Number.isNaN(n) ? null : n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Israel-time calendar day of an instant as a sortable integer YYYYMMDD,
|
||||||
|
* or null when absent/unparseable. Use this to compare two dates at *day*
|
||||||
|
* precision in Israel time (e.g. hearing-date vs. today) without runtime-tz drift.
|
||||||
|
*/
|
||||||
|
export function israelDayKey(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
): number | null {
|
||||||
|
const iso = formatIsoDate(value, ""); // "YYYY-MM-DD" or ""
|
||||||
|
if (!iso) return null;
|
||||||
|
const n = Number(iso.replace(/-/g, ""));
|
||||||
|
return Number.isNaN(n) ? null : n;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Today's Israel-time calendar day as a sortable integer YYYYMMDD. */
|
||||||
|
export function todayIsraelDayKey(): number {
|
||||||
|
return israelDayKey(new Date()) as number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The UTC-ms of midnight (00:00) of the instant's *Israel* calendar day.
|
||||||
|
* Day-precision pivot for ms-based comparisons/diffs (e.g. hearing date vs.
|
||||||
|
* today) that must not drift with the runtime timezone. Returns null when the
|
||||||
|
* value is absent/unparseable. Built from the en-CA YYYY-MM-DD of the Israel day
|
||||||
|
* combined with the Israel UTC offset at that instant, so two values from the
|
||||||
|
* same Israel day always reduce to the same ms.
|
||||||
|
*/
|
||||||
|
export function israelMidnightMs(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
): number | null {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return null;
|
||||||
|
const iso = formatIsoDate(d, ""); // YYYY-MM-DD of the Israel day
|
||||||
|
if (!iso) return null;
|
||||||
|
const [y, m, day] = iso.split("-").map(Number);
|
||||||
|
// Israel wall-clock midnight as a UTC instant: take naive UTC midnight of that
|
||||||
|
// calendar day and subtract Israel's offset (Israel is ahead of UTC).
|
||||||
|
const naiveUtcMidnight = Date.UTC(y, m - 1, day);
|
||||||
|
const utc = new Date(d.toLocaleString("en-US", { timeZone: "UTC" }));
|
||||||
|
const isr = new Date(d.toLocaleString("en-US", { timeZone: TZ }));
|
||||||
|
const offsetMs = isr.getTime() - utc.getTime();
|
||||||
|
return naiveUtcMidnight - offsetMs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** UTC-ms of midnight of *today's* Israel calendar day. */
|
||||||
|
export function todayIsraelMidnightMs(): number {
|
||||||
|
return israelMidnightMs(new Date()) as number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Numeric date/time components of an instant in Israel time. For the rare call
|
||||||
|
* site that builds a bespoke string from parts (e.g. a custom weekday + dd/MM
|
||||||
|
* HH:mm deadline label) and must do so in Israel time rather than the runtime
|
||||||
|
* tz. `weekday` is 0=Sunday … 6=Saturday (matching `Date.getDay()`).
|
||||||
|
* Returns null when the value is absent/unparseable.
|
||||||
|
*/
|
||||||
|
export function israelParts(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
): { year: number; month: number; day: number; hour: number; minute: number; weekday: number } | null {
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return null;
|
||||||
|
const parts = new Intl.DateTimeFormat("en-US", {
|
||||||
|
timeZone: TZ,
|
||||||
|
year: "numeric",
|
||||||
|
month: "2-digit",
|
||||||
|
day: "2-digit",
|
||||||
|
hour: "2-digit",
|
||||||
|
minute: "2-digit",
|
||||||
|
weekday: "short",
|
||||||
|
hour12: false,
|
||||||
|
}).formatToParts(d);
|
||||||
|
const get = (t: string) => parts.find((p) => p.type === t)?.value ?? "";
|
||||||
|
const WD: Record<string, number> = { Sun: 0, Mon: 1, Tue: 2, Wed: 3, Thu: 4, Fri: 5, Sat: 6 };
|
||||||
|
let hour = Number(get("hour"));
|
||||||
|
if (hour === 24) hour = 0; // some engines emit "24" for midnight under hour12:false
|
||||||
|
return {
|
||||||
|
year: Number(get("year")),
|
||||||
|
month: Number(get("month")),
|
||||||
|
day: Number(get("day")),
|
||||||
|
hour,
|
||||||
|
minute: Number(get("minute")),
|
||||||
|
weekday: WD[get("weekday")] ?? 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relative "time ago" in Hebrew. Timezone-agnostic (it's a diff between two
|
||||||
|
* absolute instants), but centralized here so all relative rendering lives in
|
||||||
|
* one place. `units` selects the existing wording per call site so visible text
|
||||||
|
* is unchanged:
|
||||||
|
* - "long": עכשיו / לפני N דקות / לפני N שעות / לפני N ימים
|
||||||
|
* - "short": עכשיו / לפני N דק׳ / לפני N שע׳ / לפני N ימים
|
||||||
|
* - "tight": לפני Nד' / לפני Nש' / לפני N ימים (no "now" bucket)
|
||||||
|
*/
|
||||||
|
export function formatRelative(
|
||||||
|
value: string | number | Date | null | undefined,
|
||||||
|
opts: { units?: "long" | "short" | "tight"; fallback?: string } = {},
|
||||||
|
): string {
|
||||||
|
const { units = "short", fallback = "" } = opts;
|
||||||
|
const d = toDate(value);
|
||||||
|
if (!d) return fallback;
|
||||||
|
|
||||||
|
const diffMs = Date.now() - d.getTime();
|
||||||
|
const mins = Math.floor(diffMs / 60_000);
|
||||||
|
const hours = Math.floor(mins / 60);
|
||||||
|
const days = Math.floor(hours / 24);
|
||||||
|
|
||||||
|
if (units === "tight") {
|
||||||
|
if (mins < 60) return `לפני ${mins}ד'`;
|
||||||
|
if (hours < 24) return `לפני ${hours}ש'`;
|
||||||
|
return `לפני ${days} ימים`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const now = "עכשיו";
|
||||||
|
if (units === "long") {
|
||||||
|
if (mins < 1) return now;
|
||||||
|
if (mins < 60) return `לפני ${mins} דקות`;
|
||||||
|
if (hours < 24) return `לפני ${hours} שעות`;
|
||||||
|
return `לפני ${days} ימים`;
|
||||||
|
}
|
||||||
|
|
||||||
|
// "short"
|
||||||
|
if (mins < 1) return now;
|
||||||
|
if (mins < 60) return `לפני ${mins} דק׳`;
|
||||||
|
if (hours < 24) return `לפני ${hours} שע׳`;
|
||||||
|
return `לפני ${days} ימים`;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user