UNPKG

is-leap-year

Version:

check if the given year is a leap year

17 lines (13 loc) 284 B
/** * Check if the given `year` is a leap year * * @api public * @param {Date|Number} year * @return {Boolean} */ module.exports = function (year) { year = (year instanceof Date) ? year.getFullYear() : year; return !(new Date(year, 1, 29).getMonth() - 1); };