getWeeksUntil()function

getWeeksUntil(target: PossibleDate, current?: PossibleDate, caller: AnyCaller = getWeeksUntil): 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 getWeeksUntil itself). Defaults to getWeeksUntil
Return
number
Number of whole weeks 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 weeks until a date.

  • Rounds down to the nearest whole week, i.e.

Examples

getWeeksUntil(target) // 9