formatDuration
Render a millisecond duration as a human-readable label suitable for the chat-reasoning "Thought for Ns" pill.
- <1 s → "<1s"
- 1–59 s → "Ns" (e.g. "4s")
- ≥60 s → "Nm Ms" (e.g. "1m 12s", "60m 0s")
Negative or non-finite inputs collapse to "<1s" so a corrupted timing map never produces noisy output.
import { formatDuration } from '@threadplane/chat';Declaration · overload 1
export declare function formatDuration(ms: number): string;Parameters
ms· requirednumber
Returns
string