@technobuddha/library
Version:
A large library of useful functions
14 lines (13 loc) • 529 B
JavaScript
/**
* Determine if a date is at midnight
*
* @param input A date
* @param __namedParamaters see {@link Options}
* @returns true, if the date is at midnight
*/
export function isMidnight(input, { UTC = false } = {}) {
if (UTC)
return input.getUTCHours() === 0 && input.getUTCMinutes() === 0 && input.getUTCSeconds() === 0 && input.getUTCMilliseconds() === 0;
return input.getHours() === 0 && input.getMinutes() === 0 && input.getSeconds() === 0 && input.getMilliseconds() === 0;
}
export default isMidnight;