getAgo()function
getAgo(target: PossibleDate, current: PossibleDate = "now", caller: AnyCaller = getAgo): DurationData
| Param | Type | |
|---|---|---|
target | PossibleDate | Date the duration counts back from. required |
current | PossibleDate | Date the duration counts to (defaults to now). Defaults to "now" |
caller | AnyCaller |
| Return | |
|---|---|
DurationData |
| Throws | |
|---|---|
RequiredError | If target or current cannot be converted to a valid date. |
Get the various time units since a certain date.
Examples
getAgo("2000-01-01") // { years: 26, ... }