@technobuddha/library
Version:
A large library of useful functions
17 lines (16 loc) • 589 B
JavaScript
import isSameMonth from '../isSameMonth';
/**
* Determine if two dates occur on the same day
*
* @param input1 The first date
* @param input2 The second date
* @param __namedParameters see {@link Options}
* @default UTC false
* @returns true, if the two dates fall on the same day
*/
export function isSameDay(input1, input2, { UTC = false } = {}) {
if (UTC)
return input1.getUTCDate() === input2.getUTCDate() && isSameMonth(input1, input2, { UTC });
return input1.getDate() === input2.getDate() && isSameMonth(input1, input2, { UTC });
}
export default isSameDay;