function isLeap(year) {
  const yearNumber = year instanceof Date ? year.getFullYear() : year;
  return yearNumber % 4 === 0 && yearNumber % 100 !== 0 ||
    yearNumber % 400 === 0;
}
/**
 * Check given year is a leap year or not.
 * based on : https://docs.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year
 * @param year year in number or Date format
 */
Check given year is a leap year or not.
Check given year is a leap year or not .
function isLeap(year) {
  const yearNumber = year instanceof Date ? year.getFullYear() : year;
  return yearNumber % 4 === 0 && yearNumber % 100 !== 0 ||
    yearNumber % 400 === 0;
}
function isLeap ( year ) { const yearNumber = year instanceof Date ? year . getFullYear ( ) : year ; return yearNumber % 4 === 0 && yearNumber % 100 !== 0 || yearNumber % 400 === 0 ; }
Check given year is a leap year or not.
Check given year is a leap year or not .