getDaysUntil()function
getDaysUntil(target: PossibleDate, current?: PossibleDate, caller: AnyCaller = getDaysUntil): number
| Param | Type | |
|---|---|---|
target | PossibleDate | Date to count up to. required |
current | PossibleDate | Date to count from (defaults to now). |
caller | AnyCaller | Function to attribute a thrown error to (defaults to getDaysUntil itself). Defaults to getDaysUntil |
| Return | |
|---|---|
number | Number of calendar days 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 calendar days until a date.
- e.g. from 23:59 to 00:01 is 1 day, even though it's only 1 minutes.
Examples
getDaysUntil(target) // 13