Skip to main content

Function: timeAgo()

function timeAgo(date: DateParam, options: TimeAgoOptions): string

Show the time passed since the given date, in the desired format.

Parameters

ParameterTypeDescription
dateDateParamThe date since which to calculate the duration.
optionsTimeAgoOptionsformat 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 date.

Defined in

src/lib/util.ts:65