getMidnight()function
getMidnight(target?: PossibleDate, caller: AnyCaller = getMidnight): Date
| Param | Type | |
|---|---|---|
target | PossibleDate | The date to find midnight for (defaults to "now"). |
caller | AnyCaller | The function to attribute a thrown error to (defaults to getMidnight). Defaults to getMidnight |
| Return | |
|---|---|
Date | A new Date instance at midnight of the target date. |
| Throws | |
|---|---|
RequiredError | If target couldn't be converted to a valid date. |
Get a Date representing exactly midnight of the specified date.
Examples
getMidnight("2003-09-12") // Date instance for 2003-09-12 at 00:00