fix(ui): times honour the Appearance zone, one duration formatter everywhere (#1761)
deploy / gate (push) Successful in 4m54s
Quality / check (push) Successful in 6m44s
deploy / archied-image (push) Successful in 3m44s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped

lib/format.ts gains shortTime(value, zone) and becomes the home of the
single duration() formatter (moved from timeline-event.ts, which
re-exports it so the stage rail and duration.test.ts are unchanged).
LogTable's time column, audit's From/To chips and chat session titles now
format in the zone chosen under Appearance instead of the browser's.
StepNode, schedule runDuration, labels formatMs and ChatToolCall all
delegate to duration(), removing the "12ms" vs "12 ms" vs "under 1 s"
split.
This commit is contained in:
sam committed 2026-11-06 22:21:45 +11:00
1 parent ca107f6977
commit 0dc5bf9a9b
10 files changed
+73 -59

No files matched your search

+2 -6
View File
@@ -7,6 +7,7 @@ import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";
import { Input } from "@/components/ui/input";
import { duration } from "@/lib/format";
import { stepIcon } from "./step-icons";
import { stepTitle, type StepNodeData } from "./workflow-graph";
@@ -72,12 +73,7 @@ const badge = computed(() => {
});
const number = computed(() => (props.data.step ? `${Number(props.data.step)}.` : ""));
function duration(ms?: number): string {
if (ms === undefined) return "";
if (ms < 1000) return `${ms} ms`;
const seconds = Math.round(ms / 1000);
return seconds < 60 ? `${seconds}s` : `${Math.floor(seconds / 60)}m ${seconds % 60}s`;
}
const card = ref<HTMLElement | null>(null);
let observer: ResizeObserver | undefined;
+3 -4
View File
@@ -1,5 +1,7 @@
/** Naming and numbers shared by the workflow tables. */
import { duration } from "../lib/format.ts";
const WORKFLOW_LABELS: Record<string, string> = {
implement: "Implement",
tdd: "TDD",
@@ -27,8 +29,5 @@ export function pct(
export function formatMs(ms: number | undefined | null): string {
if (!ms) return "–";
if (ms < 1000) return `${ms} ms`;
const secs = ms / 1000;
if (secs < 60) return `${secs.toFixed(1)} s`;
return `${(secs / 60).toFixed(1)} min`;
return duration(ms);
}