@technobuddha/library
Version:
A large library of useful functions
16 lines (15 loc) • 488 B
JavaScript
/**
* Determine if two dates occur in the same year
*
* @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 year
*/
export function isSameYear(input1, input2, { UTC = false } = {}) {
if (UTC)
return input1.getUTCFullYear() === input2.getUTCFullYear();
return input1.getFullYear() === input2.getFullYear();
}
export default isSameYear;