JavaScript function to determine if the specified Date object occurs in a Leap year.
/**
* Check if the given date occurs in a leap year
*
* from date-fns (modern JavaScript date utility library) `isLeapYear`
* https://github.com/date-fns/date-fns/blob/master/src/isLeapYear/index.js
*
* @param {Date} date - the date to check
* @returns {Boolean} the date is in the leap year
* @example
* // Is 1 September 2012 in the leap year?
* var result = isLeapYear(new Date(2012, 8, 1));
* //=> true
*/
function isLeapYear(date) {
var year = date.getFullYear();
return year % 400 === 0 || (year % 4 === 0 && year % 100 !== 0);
}