getUntil()function

getUntil(target: PossibleDate, current: PossibleDate = "now", caller: AnyCaller = getUntil): DurationData
ParamType
targetPossibleDate
Date the duration counts up to. required
currentPossibleDate
Date the duration counts from (defaults to now). Defaults to "now"
callerAnyCaller
Function to attribute a thrown error to (defaults to getUntil itself). Defaults to getUntil
Return
DurationData
DurationData object for the span from current to target.
Throws
RequiredError
If target or current cannot be converted to a valid date.

Get the various time units until a certain date.

Examples

getUntil("2099-01-01") // { years: 73, ... }