Function: formatDuration()
function formatDuration(duration: number, options: TimeAgoOptions): string
Format a duration in milliseconds to a human-readable string.
Parameters
Parameter | Type | Description |
---|---|---|
duration | number | The duration in milliseconds. |
options | TimeAgoOptions | format takes "brief" or "mini". "brief" rounds the date and uses the largest suitable unit (e.g. "4 weeks"). "mini" uses something like "4w" (for 4 weeks). |
Returns
string
The formatted duration.