I
FormatTimeAgoOptions
testeddemoOptions shared by the pure `formatTimeAgo` and the reactive `useTimeAgo`.
Demo
Loading demo…
Signature
ts
interface FormatTimeAgoOptions<UnitNames extends string = UseTimeAgoUnitName>Type Parameters
UnitNamesextends string= UseTimeAgoUnitNameProperties
| Property | Type | Description |
|---|---|---|
max? | number | UnitNames | undefined | Maximum unit (or absolute ms diff) to display before falling back to `fullDateFormatter`. |
fullDateFormatter? | ((date: Date) => string) | undefined | Formatter applied when the diff exceeds `max`. |
messages? | UseTimeAgoMessages<UnitNames> | undefined | Localized messages. |
showSecond? | boolean | undefined | Show seconds (i.e. allow sub-minute granularity) instead of `justNow`. |
rounding? | number | "round" | "ceil" | "floor" | undefined | Rounding strategy applied to unit values. A string maps to the matching `Math` method; a number rounds to that many decimal places. |
units? | UseTimeAgoUnit<UnitNames>[] | undefined | Custom ordered list of units (ascending by `value`). |