Skip to content

relativeTime

function relativeTime(input, now?): string;

Defined in: src/ui/format.ts:70

Compact relative time: "just now", "5m ago", "in 2h", "3d ago", "2mo ago", "1y ago". Values are floored, so "1h ago" means at least one full hour. now is injectable for tests.

Parameter Type
input string | number | Date | null | undefined
now? number

string