getMinutesUntil()function

getMinutesUntil(target: PossibleDate, current?: PossibleDate, caller: AnyCaller = getMinutesUntil): number
ParamType
targetPossibleDate
Date to count up to. required
currentPossibleDate
Date to count from (defaults to now).
callerAnyCaller
Function to attribute a thrown error to (defaults to getMinutesUntil itself). Defaults to getMinutesUntil
Return
number
Number of whole minutes from current to target (negative if target is in the past).
Throws
RequiredError
If target or current cannot be converted to a valid date.

Count the whole minutes until a date.

  • Rounds to the nearest whole minute, i.e. 1 min 29 seconds returns 1

Examples

getMinutesUntil(target) // 5