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