R
I

FormatTimeAgoOptions

testeddemo

Options shared by the pure `formatTimeAgo` and the reactive `useTimeAgo`.

Demo

Loading demo…

Signature

ts
interface FormatTimeAgoOptions<UnitNames extends string = UseTimeAgoUnitName>

Type Parameters

UnitNamesextends string= UseTimeAgoUnitName

Properties

PropertyTypeDescription
max?number | UnitNames | undefinedMaximum unit (or absolute ms diff) to display before falling back to `fullDateFormatter`.
fullDateFormatter?((date: Date) => string) | undefinedFormatter applied when the diff exceeds `max`.
messages?UseTimeAgoMessages<UnitNames> | undefinedLocalized messages.
showSecond?boolean | undefinedShow seconds (i.e. allow sub-minute granularity) instead of `justNow`.
rounding?number | "round" | "ceil" | "floor" | undefinedRounding strategy applied to unit values. A string maps to the matching `Math` method; a number rounds to that many decimal places.
units?UseTimeAgoUnit<UnitNames>[] | undefinedCustom ordered list of units (ascending by `value`).