Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(frontend): keep a narrowed date's day whole in every locale
zchpeterf8e6c56a9d45
diff --git a/docs/design/timestamp-display.md b/docs/design/timestamp-display.mdindex e9c8c281b0..27136cc162 100644--- a/docs/design/timestamp-display.md+++ b/docs/design/timestamp-display.md@@ -147,11 +147,15 @@ Where the browser spreads spare width across every sized column, the open-endedrun's detail — is left unsized to take it, so the date neither wraps nor swells; the audit log doesnot do this yet, and its date grows with the rest. Where a table fits its columns to the containeritself, a date column takes none of the spare width, and a column raised to its floor takes that-width from the others rather than overrunning the container. The minimum is one value for every-form, 140px: the date alone where it is written widest, in Japanese. Narrower than its form a cell-ellipsizes from the end, so it keeps what the locale writes first — the date in most locales, the-time and zone in Vietnamese — and in Japanese and Chinese the ellipsis takes the date's last-character. The hover, or one drag, gives the rest back.+width from the others rather than overrunning the container. A cell narrower than its form keeps the+day: the date, written as the locale writes a date alone, never shrinks, and the time and zone+ellipsize on whichever side of it the locale puts them — after it in most locales, before it in+Vietnamese — with the space between kept, so a cut time never runs into the date. Cutting the label+from its end would keep what the locale writes first, which in Vietnamese is the time. A cell asks+for this with `HumanizeTs`'s `truncate`; a locale whose label does not begin or end with its date+falls back to cutting the end. The minimum is one value for every form, 154px: the date where it is+written widest, in Japanese and Chinese, the space, and a whole ellipsis, so a narrowed cell still+shows there is a time. The hover, or one drag, gives the rest back.## Surface classification@@ -170,7 +174,7 @@ Every current `HumanizeTs` call site, classified under the principle:| Schema sync status | `modules/sql-editor/components/SchemaPane/SyncSchemaButton.tsx`, `routes/project/ProjectSyncSchemaPage.tsx`, `components/database/DatabaseOverviewInfo.tsx` | Freshness | 30d switch || Agent chat | `modules/agent/components/AgentWindow.tsx` | Feed | 30d switch || Plan-check run time | `components/plan-check/PlanCheckSection.tsx` (bare `toLocaleString()` today — adopts `HumanizeTs`) | Freshness | 30d switch |-| Access-grant creation time | `routes/project/ProjectAccessGrantsPage.tsx` (`AccessGrantRow`; full absolute today — adopts `HumanizeTs`). Shares the operational form with the expiration beside it: two dates in one row read in one format, and consistency outranks the freshness a relative age would add. The row's status, statement, creator and databases carry what a reader acts on — the status turns Expired by itself — so the dates take none of the spare width, and when the table is narrower than the defaults together they give way first, down to the timestamp minimum, then the statement, the creator and the databases, with the status last. A narrow screen cuts the end of each date, the zone in most locales; the full date-time stays on the hover | Operational | Operational (D6 tooltip) |+| Access-grant creation time | `routes/project/ProjectAccessGrantsPage.tsx` (`AccessGrantRow`; full absolute today — adopts `HumanizeTs`). Shares the operational form with the expiration beside it: two dates in one row read in one format, and consistency outranks the freshness a relative age would add. The row's status, statement, creator and databases carry what a reader acts on — the status turns Expired by itself — so the dates take none of the spare width, and when the table is narrower than the defaults together they give way first, down to the timestamp minimum, then the statement, the creator and the databases, with the status last. A narrow screen cuts each date's time and zone and keeps its day; the full date-time stays on the hover | Operational | Operational (D6 tooltip) || **Database changelog** | `routes/project/database-detail/changelog/DatabaseChangelogTable.tsx` | **History view** | **Absolute always — compact tier (D7)** || **Database revisions** | `routes/project/database-detail/revision/DatabaseRevisionTable.tsx` | **History view** | **Absolute always — compact tier (D7)** || **Task-run history** | `routes/project/plan-detail/components/deploy/DeployTaskRunHistorySheet.tsx`, `routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx` | **History view** | **Absolute always — compact tier (D7)** |diff --git a/frontend/src/components/AuditLogTable.test.tsx b/frontend/src/components/AuditLogTable.test.tsxindex 326f69e8f7..f28adb1702 100644--- a/frontend/src/components/AuditLogTable.test.tsx+++ b/frontend/src/components/AuditLogTable.test.tsx@@ -194,6 +194,44 @@ describe("AuditLogTable", () => {unmount();});+ test("opens the date whole, and lets a reader narrow it to the day", async () => {+ mocks.searchAuditLogs.mockResolvedValue({+ auditLogs: [+ create(AuditLogSchema, {+ name: "auditLogs/1",+ createTime: timestampFromMs(Date.UTC(2026, 2, 2, 12)),+ }),+ ],+ nextPageToken: "",+ });+ const { container, render, unmount } = renderIntoContainer(+ <AuditLogTable parent="projects/-" canExport={false} />+ );+ await render();++ const [created] = Array.from(container.querySelectorAll("col"));+ expect(created.style.width).toBe(`${TIMESTAMP_COLUMN_WIDTH.datetime}px`);++ const handle = container.querySelector("th [class*=cursor-col-resize]");+ act(() => {+ handle?.dispatchEvent(+ new MouseEvent("mousedown", { bubbles: true, clientX: 400 })+ );+ document.dispatchEvent(new MouseEvent("mousemove", { clientX: 300 }));+ document.dispatchEvent(new MouseEvent("mouseup"));+ });+ expect(created.style.width).toBe(+ `${TIMESTAMP_COLUMN_WIDTH.datetime - 100}px`+ );+ // jsdom lays nothing out, so the classes are what say a narrowed date+ // keeps its day and ellipsizes the rest rather than breaking in two.+ const date = container.querySelector("tbody tr td:first-child");+ expect(date?.querySelector(".shrink-0")).not.toBeNull();+ expect(date?.querySelector(".truncate")).not.toBeNull();++ unmount();+ });+test("keeps the full date-time on one line at any width", async () => {// The evidence tier's tooltip is the age, which cannot give the value// back, so its column never narrows past the form: sized to it, and thediff --git a/frontend/src/components/AuditLogTable.tsx b/frontend/src/components/AuditLogTable.tsxindex 0ff468016f..2de125fabc 100644--- a/frontend/src/components/AuditLogTable.tsx+++ b/frontend/src/components/AuditLogTable.tsx@@ -448,8 +448,8 @@ function useColumnDefs(): ColumnDef[] {render: (log: AuditLog) =>log.createTime ? (<HumanizeTs- className="block truncate"mode="datetime"+ truncatetsMs={getTimeForPbTimestampProtoEs(log.createTime)}/>) : (diff --git a/frontend/src/components/HumanizeTs.test.tsx b/frontend/src/components/HumanizeTs.test.tsxindex 1dd0415bc4..be058135fc 100644--- a/frontend/src/components/HumanizeTs.test.tsx+++ b/frontend/src/components/HumanizeTs.test.tsx@@ -72,6 +72,7 @@ const formatters = vi.hoisted(() => {compactTimeReading: fixedReading("compact"),operationalTimeReading: fixedReading("operational"),absoluteTimeReading: fixedReading("absolute"),+ dateTimeSegments: vi.fn(),};});@@ -117,6 +118,7 @@ describe("HumanizeTs", () => {vi.setSystemTime(new Date("2026-03-02T12:00:00Z"));language.current = "en";formatters.formatAbsoluteDateTime.mockClear();+ formatters.dateTimeSegments.mockReset();});afterEach(() => {@@ -155,13 +157,88 @@ describe("HumanizeTs", () => {test("renders one element, so layout classes reach the box that lays out", () => {const { container, root } = mount();act(() =>- root.render(<HumanizeTs className="block truncate" tsMs={1_000_000} />)+ root.render(<HumanizeTs className="block text-xs" tsMs={1_000_000} />));expect(container.childElementCount).toBe(1);- expect(container.firstElementChild?.className).toContain("block truncate");+ expect(container.firstElementChild?.className).toContain("block text-xs");expect(container.firstElementChild?.childElementCount).toBe(0);});+ // Each piece of a fitted label, and whether it keeps its width or gives way.+ const pieces = (box: Element | null) =>+ Array.from(box?.children ?? []).map((piece) => {+ const fit = piece.classList.contains("truncate")+ ? "cut"+ : piece.classList.contains("shrink-0")+ ? "kept"+ : "loose";+ return `${piece.textContent}:${fit}`;+ });++ test.each([+ [+ "after the date",+ { date: "Sep 21, 2026", rest: ", 11:28 PM GMT+8", dateFirst: true },+ ["Sep 21, 2026:kept", ", 11:28 PM GMT+8:cut"],+ ],+ [+ "after the date and a space",+ { date: "2026年9月21日", rest: " 23:28", dateFirst: true },+ ["2026年9月21日:kept", " :kept", "23:28:cut"],+ ],+ [+ "before the date",+ { date: "21 thg 9, 2026", rest: "23:28 GMT+8 ", dateFirst: false },+ ["23:28 GMT+8:cut", " :kept", "21 thg 9, 2026:kept"],+ ],+ ])(+ "keeps a narrowed date whole and cuts the time written %s",+ async (_, segments, expected) => {+ formatters.dateTimeSegments.mockReturnValue(segments);+ const { container, root } = mount();+ act(() =>+ root.render(+ <HumanizeTs+ className="text-xs"+ mode="operational"+ truncate+ tsMs={1_000_000}+ />+ )+ );++ const box = container.firstElementChild;+ expect(formatters.dateTimeSegments).toHaveBeenCalledWith(+ "operational:1000000:en",+ 1_000_000+ );+ expect(box?.className).toContain("text-xs");+ expect(pieces(box)).toEqual(expected);++ await openTooltip(box);+ expect(overlayText()).toContain("absolute:1000000");+ }+ );++ test("cuts a narrowed label from its end when it will not split", () => {+ formatters.dateTimeSegments.mockReturnValue(undefined);+ const { container, root } = mount();+ act(() =>+ root.render(<HumanizeTs mode="compact" truncate tsMs={1_000_000} />)+ );+ const box = container.firstElementChild;+ expect(box?.className).toContain("block truncate");+ expect(box?.textContent).toBe("compact:1000000:en");+ expect(box?.childElementCount).toBe(0);+ });++ test("never splits a label that carries no time", () => {+ const { container, root } = mount();+ act(() => root.render(<HumanizeTs truncate tsMs={1_000_000} />));+ expect(formatters.dateTimeSegments).not.toHaveBeenCalled();+ expect(container.firstElementChild?.className).toContain("block truncate");+ });+test("offers the age on a full cell, and keeps it counting while open", async () => {const { container, root } = mount();act(() => root.render(<HumanizeTs mode="datetime" tsMs={secondsAgo(30)} />));diff --git a/frontend/src/components/HumanizeTs.tsx b/frontend/src/components/HumanizeTs.tsxindex 589900a6bc..2ad4912c7c 100644--- a/frontend/src/components/HumanizeTs.tsx+++ b/frontend/src/components/HumanizeTs.tsx@@ -2,9 +2,12 @@ import type { ComponentType } from "react";import { useTranslation } from "react-i18next";import { Tooltip } from "@/components/ui/tooltip";import { useTimeReading } from "@/hooks/useTimeReading";+import { cn } from "@/lib/utils";import {absoluteTimeReading,compactTimeReading,+ type DateTimeSegments,+ dateTimeSegments,displayableInstantMs,formatAbsoluteDateTime,operationalTimeReading,@@ -31,6 +34,11 @@ interface HumanizeTsProps {tsMs: number | undefined;mode?: TimeDisplayMode;className?: string;+ /**+ * Keep the label on one line inside its box. Where the box is narrower than+ * the label, the time and zone ellipsize and the date stays whole.+ */+ truncate?: boolean;/*** Whether to reveal the hidden reading on hover. Defaults to true.* Disable only inside agent-layer overlays, where the shared Tooltip mounts@@ -50,21 +58,51 @@ function RelativeAge({ tsMs }: { tsMs: number }) {return <>{useTimeReading(relativeTimeReading, tsMs)}</>;}-// Each mode's label reading, and the reading its tooltip restores: the full-// date-time for every reduced form, the age for the full one.+// Each mode's label reading, the reading its tooltip restores — the full+// date-time for every reduced form, the age for the full one — and whether+// its label carries a time that can give way to the date.const MODES: Record<TimeDisplayMode,{label: TimeReading<number, string>;Hidden: ComponentType<{ tsMs: number }>;+ hasTime: boolean;}> = {- queue: { label: queueTimeReading, Hidden: FullDateTime },- compact: { label: compactTimeReading, Hidden: FullDateTime },- operational: { label: operationalTimeReading, Hidden: FullDateTime },- datetime: { label: absoluteTimeReading, Hidden: RelativeAge },+ queue: { label: queueTimeReading, Hidden: FullDateTime, hasTime: false },+ compact: { label: compactTimeReading, Hidden: FullDateTime, hasTime: true },+ operational: {+ label: operationalTimeReading,+ Hidden: FullDateTime,+ hasTime: true,+ },+ datetime: { label: absoluteTimeReading, Hidden: RelativeAge, hasTime: true },};+// The space where the time meets the date is kept out of the part that gives+// way, so a cut time never runs into the date, and is `whitespace-pre`+// because a flex item drops the space at its edge.+function DateKeptWhole({ date, rest, dateFirst }: DateTimeSegments) {+ const time = dateFirst ? rest.trimStart() : rest.trimEnd();+ const gap = dateFirst+ ? rest.slice(0, rest.length - time.length)+ : rest.slice(time.length);+ const pieces = [+ <span key="date" className="shrink-0">+ {date}+ </span>,+ gap ? (+ <span key="gap" className="shrink-0 whitespace-pre">+ {gap}+ </span>+ ) : null,+ <span key="time" className="min-w-0 truncate">+ {time}+ </span>,+ ];+ return <>{dateFirst ? pieces : pieces.reverse()}</>;+}+/*** Renders a timestamp in the form its surface calls for, and by default* reveals on hover the reading its label hides. This is the single canonical@@ -74,6 +112,7 @@ export function HumanizeTs({tsMs: instantMs,mode = "queue",className,+ truncate = false,tooltip = true,}: HumanizeTsProps) {// Subscribe to locale changes so the rendered strings update on a language switch.@@ -81,20 +120,31 @@ export function HumanizeTs({// A row loses its timestamp rather than the page its subtree: what is not an// instant has no rendering, and the formatters throw on it.const tsMs = displayableInstantMs(instantMs);- const { label: labelReading, Hidden } = MODES[mode];+ const { label: labelReading, Hidden, hasTime } = MODES[mode];const label = useTimeReading(labelReading, tsMs);if (tsMs === undefined) {return null;}+ const segments =+ truncate && hasTime && label !== undefined+ ? dateTimeSegments(label, tsMs)+ : undefined;+ const boxClassName = !truncate+ ? className+ : cn(+ segments ? "flex min-w-0 overflow-hidden" : "block truncate",+ className+ );+ const content = segments ? <DateKeptWhole {...segments} /> : label;if (!tooltip) {- return <span className={className}>{label}</span>;+ return <span className={boxClassName}>{content}</span>;}return (<Tooltipcontent={<Hidden tsMs={tsMs} />}- render={<span className={className} />}+ render={<span className={boxClassName} />}>- {label}+ {content}</Tooltip>);}diff --git a/frontend/src/components/timestampColumn.test.ts b/frontend/src/components/timestampColumn.test.tsindex 00eb9a0f79..d66e9ed5ea 100644--- a/frontend/src/components/timestampColumn.test.ts+++ b/frontend/src/components/timestampColumn.test.ts@@ -9,7 +9,9 @@ import {// zone, the five shipped locales, and every month and local hour of a year,// at 14px in the macOS system font, plus 32px of cell padding.const MEASURED_FORM = { compact: 191, operational: 269, datetime: 291 };-const MEASURED_DATE = 140;+// The date on every day of a year, the space before the time, and an+// ellipsis, at its widest.+const MEASURED_NARROWEST = 154;const forms = Object.keys(MEASURED_FORM) as (keyof typeof MEASURED_FORM)[];@@ -23,8 +25,10 @@ describe("timestamp column widths", () => {});- test("never narrow a column past the date", () => {- expect(TIMESTAMP_COLUMN_MIN_WIDTH).toBeGreaterThanOrEqual(MEASURED_DATE);+ test("never narrow a column past the date and a sign of the time", () => {+ expect(TIMESTAMP_COLUMN_MIN_WIDTH).toBeGreaterThanOrEqual(+ MEASURED_NARROWEST+ );});test.each(forms)("let a reader narrow a %s column at all", (form) => {diff --git a/frontend/src/components/timestampColumn.ts b/frontend/src/components/timestampColumn.tsindex 55c441254c..cc9a21b40b 100644--- a/frontend/src/components/timestampColumn.ts+++ b/frontend/src/components/timestampColumn.ts@@ -15,9 +15,9 @@ export const TIMESTAMP_COLUMN_WIDTH = {} as const;/**- * How far any timestamp column may narrow: the date alone, measured the same- * way, which ja-JP writes widest. A narrower cell ellipsizes from the end, so- * it keeps the date only where the locale writes the date first; vi-VN- * writes the time first.+ * How far any timestamp column may narrow, measured the same way: the date+ * whole, the space where the time meets it, and a whole ellipsis saying the+ * time is there. ja-JP and zh-CN need the most. `HumanizeTs`'s `truncate`+ * is what keeps the date whole.*/-export const TIMESTAMP_COLUMN_MIN_WIDTH = 140;+export const TIMESTAMP_COLUMN_MIN_WIDTH = 154;diff --git a/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsx b/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsxindex a7be351910..96031de240 100644--- a/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsx+++ b/frontend/src/routes/project/ProjectAccessGrantsPage.test.tsx@@ -11,6 +11,7 @@ import { distributeColumnWidths } from "@/hooks/useColumnWidths";import {shownTimestampInstants,shownTimestampModes,+ shownTimestampTruncates,} from "@/test-utils/humanizeTs";import {AccessGrant_Status,@@ -158,7 +159,7 @@ describe("AccessGrantRow", () => {expect(cell("actions").textContent).toBe("sql-editor.revoke-access");});- test("dates a grant's creation and expiry in one form, each ellipsizing", () => {+ test("dates a grant's creation and expiry in one form, each fitting its box", () => {const container = document.createElement("div");const root = createRoot(container);roots.push(root);@@ -186,15 +187,10 @@ describe("AccessGrantRow", () => {));- const dates = container.querySelectorAll<HTMLElement>(- "[data-testid=humanize-ts]"- );expect(shownTimestampModes(container)).toEqual(["operational","operational",]);- for (const date of dates) {- expect(date.className).toContain("truncate");- }+ expect(shownTimestampTruncates(container)).toEqual([true, true]);});});diff --git a/frontend/src/routes/project/ProjectAccessGrantsPage.tsx b/frontend/src/routes/project/ProjectAccessGrantsPage.tsxindex fe3a81704f..c8cbdcb57d 100644--- a/frontend/src/routes/project/ProjectAccessGrantsPage.tsx+++ b/frontend/src/routes/project/ProjectAccessGrantsPage.tsx@@ -792,21 +792,13 @@ export function AccessGrantRow({),expiration:expireTimeMs !== undefined ? (- <HumanizeTs- className="block truncate"- mode="operational"- tsMs={expireTimeMs}- />+ <HumanizeTs mode="operational" truncate tsMs={expireTimeMs} />) : ("-"),created:createdTimeMs !== undefined ? (- <HumanizeTs- className="block truncate"- mode="operational"- tsMs={createdTimeMs}- />+ <HumanizeTs mode="operational" truncate tsMs={createdTimeMs} />) : ("-"),diff --git a/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.test.tsx b/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.test.tsxindex 77bb3cd329..9d876548e3 100644--- a/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.test.tsx+++ b/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.test.tsx@@ -4,7 +4,10 @@ import type { ReactElement } from "react";import { act } from "react";import { createRoot } from "react-dom/client";import { beforeEach, describe, expect, test, vi } from "vitest";-import { shownTimestampModes } from "@/test-utils/humanizeTs";+import {+ shownTimestampModes,+ shownTimestampTruncates,+} from "@/test-utils/humanizeTs";import { ChangelogSchema } from "@/types/proto-es/v1/changelog_service_pb";(@@ -86,9 +89,6 @@ describe("DatabaseChangelogTable", () => {);expect(createdHeader.querySelector("[class*=cursor-col-resize]")).not.toBeNull();expect(rolloutHeader.querySelector("[class*=cursor-col-resize]")).toBeNull();- expect(- container.querySelector("tbody tr td:nth-child(2)")?.className- ).toContain("truncate");// A widened date pushes the table past its box, and the title -- and the// handle that would undo it -- have to stay reachable.expect(container.firstElementChild?.className).toContain("overflow-x-auto");@@ -96,7 +96,7 @@ describe("DatabaseChangelogTable", () => {unmount();});- test("dates each row in the embedded history form", () => {+ test("dates each row in the embedded history form, fitted to its column", () => {const { container, render, unmount } = renderIntoContainer(<DatabaseChangelogTableloading={false}@@ -113,6 +113,7 @@ describe("DatabaseChangelogTable", () => {// A row in a list orients the reader; the changelog's own page testifies.expect(shownTimestampModes(container)).toEqual(["compact"]);+ expect(shownTimestampTruncates(container)).toEqual([true]);unmount();});diff --git a/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx b/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsxindex e459dc1616..daa36152cd 100644--- a/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx+++ b/frontend/src/routes/project/database-detail/changelog/DatabaseChangelogTable.tsx@@ -143,10 +143,11 @@ export function DatabaseChangelogTable({<TableCell className="text-center"><ChangelogStatusIcon status={changelog.status} /></TableCell>- <TableCell className="truncate text-main">+ <TableCell className="text-main">{changelog.createTime ? (<HumanizeTsmode="compact"+ truncatetsMs={getTimeForPbTimestampProtoEs(changelog.createTime)}/>) : (diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.test.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.test.tsxindex 2d2509248b..7fe018f1c7 100644--- a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.test.tsx+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.test.tsx@@ -4,7 +4,10 @@ import { act } from "react";import { createRoot } from "react-dom/client";import { afterEach, describe, expect, test, vi } from "vitest";import { TIMESTAMP_COLUMN_WIDTH } from "@/components/timestampColumn";-import { shownTimestampModes } from "@/test-utils/humanizeTs";+import {+ shownTimestampModes,+ shownTimestampTruncates,+} from "@/test-utils/humanizeTs";import {TaskRun_Status,TaskRunSchema,@@ -82,8 +85,6 @@ describe("IssueDetailTaskRunTable", () => {expect(widthOf("task.created")).toBe(`${TIMESTAMP_COLUMN_WIDTH.compact}px`);expect(widthOf("task.started")).toBe(`${TIMESTAMP_COLUMN_WIDTH.compact}px`);expect(shownTimestampModes(container)).toEqual(["compact", "compact"]);- for (const date of container.querySelectorAll("[data-testid=humanize-ts]")) {- expect(date.className).toContain("truncate");- }+ expect(shownTimestampTruncates(container)).toEqual([true, true]);});});diff --git a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsxindex cf9bac119e..313d762856 100644--- a/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx+++ b/frontend/src/routes/project/issue-detail/components/IssueDetailTaskRunTable.tsx@@ -191,9 +191,10 @@ function IssueDetailTaskRunDateCell({ date }: { date?: Timestamp }) {}return (<HumanizeTs+ className="text-sm text-control"mode="compact"+ truncatetsMs={getTimeForPbTimestampProtoEs(date)}- className="block truncate text-sm text-control"/>);}diff --git a/frontend/src/test-utils/humanizeTs.tsx b/frontend/src/test-utils/humanizeTs.tsxindex 6fbf7b58a5..5ce432e86e 100644--- a/frontend/src/test-utils/humanizeTs.tsx+++ b/frontend/src/test-utils/humanizeTs.tsx@@ -9,17 +9,22 @@ export const humanizeTsStub = () => ({tsMs,mode = "queue",className,+ truncate = false,}: {tsMs: number | undefined;mode?: string;className?: string;+ truncate?: boolean;}) =>// Nothing at all without an instant, as the component does: a stub that- // left an empty box behind would hide a row that kept its separator. The- // class lands on the same span it does in the component, since that is- // where a caller asks a narrowed date to ellipsize rather than wrap.+ // left an empty box behind would hide a row that kept its separator.tsMs === undefined ? null : (- <span data-testid="humanize-ts" data-mode={mode} className={className}>+ <span+ data-testid="humanize-ts"+ data-mode={mode}+ data-truncate={truncate}+ className={className}+ >{tsMs}</span>),@@ -35,3 +40,7 @@ export const shownTimestampModes = (root: ParentNode) =>/** The instant each timestamp was given, in document order. */export const shownTimestampInstants = (root: ParentNode) =>shown(root).map((node) => node.textContent);++/** Whether each timestamp was asked to fit its box, in document order. */+export const shownTimestampTruncates = (root: ParentNode) =>+ shown(root).map((node) => node.dataset.truncate === "true");diff --git a/frontend/src/utils/datetime.test.ts b/frontend/src/utils/datetime.test.tsindex 6e45de66e1..a896667877 100644--- a/frontend/src/utils/datetime.test.ts+++ b/frontend/src/utils/datetime.test.ts@@ -23,6 +23,7 @@ import {absoluteTimeReading,compactTimeReading,countdownReading,+ dateTimeSegments,daysLeftReading,displayableInstantMs,formatAbsoluteDateTime,@@ -294,6 +295,56 @@ const startAt = (start: string) => {return startMs;};+describe("dateTimeSegments", () => {+ const ts = new Date("2026-09-21T15:28:05Z").getTime();+ const forms = [+ ["compact", compactTimeReading],+ ["operational", operationalTimeReading],+ ["full", absoluteTimeReading],+ ] as const;++ test.each([+ ["en-US", "Sep 21, 2026", true],+ ["es-ES", "21 sept 2026", true],+ ["ja-JP", "2026年9月21日", true],+ ["vi-VN", "21 thg 9, 2026", false],+ ["zh-CN", "2026年9月21日", true],+ ])(+ "splits every %s date-time around the date it writes alone",+ (locale, date, dateFirst) => {+ withLocale(locale, () => {+ for (const [, reading] of forms) {+ const label = reading.read(ts);+ const segments = dateTimeSegments(label, ts);+ expect(segments).toMatchObject({ date, dateFirst });+ expect(+ dateFirst+ ? `${segments?.date}${segments?.rest}`+ : `${segments?.rest}${segments?.date}`+ ).toBe(label);+ }+ });+ }+ );++ test("leaves the separator with the time, so the date is only the date", () => {+ withLocale("ja-JP", () => {+ expect(dateTimeSegments(compactTimeReading.read(ts), ts)?.rest).toBe(+ " 23:28"+ );+ });+ withLocale("vi-VN", () => {+ expect(dateTimeSegments(compactTimeReading.read(ts), ts)?.rest).toBe(+ "23:28 "+ );+ });+ });++ test("declines a label whose date sits between its other fields", () => {+ expect(dateTimeSegments("11:28 PM Sep 21, 2026 GMT+8", ts)).toBeUndefined();+ });+});+describe("reading boundaries", () => {beforeEach(() => {vi.useFakeTimers();diff --git a/frontend/src/utils/datetime.ts b/frontend/src/utils/datetime.tsindex e16812ee18..ee3aca7dbc 100644--- a/frontend/src/utils/datetime.ts+++ b/frontend/src/utils/datetime.ts@@ -113,6 +113,13 @@ export function formatAbsoluteDateTime(timestampMs: number): string {}).format(timestampMs);}+const formatDateWithYear = (timestampMs: number): string =>+ dateTimeFormatter("dateWithYear", {+ month: "short",+ day: "numeric",+ year: "numeric",+ }).format(timestampMs);+function formatAbsoluteDate(timestampMs: number): string {if (new Date(timestampMs).getFullYear() === new Date().getFullYear()) {return dateTimeFormatter("date", {@@ -120,11 +127,7 @@ function formatAbsoluteDate(timestampMs: number): string {day: "numeric",}).format(timestampMs);}- return dateTimeFormatter("dateWithYear", {- month: "short",- day: "numeric",- year: "numeric",- }).format(timestampMs);+ return formatDateWithYear(timestampMs);}function formatQueueTime(timestampMs: number): string {@@ -155,6 +158,36 @@ function formatOperationalDateTime(timestampMs: number): string {}).format(timestampMs);}+/**+ * A date-time label as its date and the rest, so a narrowed cell can keep+ * the day. `rest` is the time, any zone, and what separates them from the+ * date, on the side the locale writes them.+ */+export type DateTimeSegments = {+ date: string;+ rest: string;+ dateFirst: boolean;+};++/**+ * Splits a date-time label of `timestampMs` around the date as the locale+ * writes a date alone, or returns undefined when the label neither begins nor+ * ends with it.+ */+export function dateTimeSegments(+ label: string,+ timestampMs: number+): DateTimeSegments | undefined {+ const date = formatDateWithYear(timestampMs);+ if (label.startsWith(date)) {+ return { date, rest: label.slice(date.length), dateFirst: true };+ }+ if (label.endsWith(date)) {+ return { date, rest: label.slice(0, -date.length), dateFirst: false };+ }+ return undefined;+}+function relativeTimeChangeAt(timestampMs: number, nowMs: number): number {const diffMs = nowMs - timestampMs;const ageMs = Math.abs(diffMs);