isLeapYear.js 342 B

123456789101112131415
  1. var isDate = require('../lang/isDate');
  2. /**
  3. * checks if it's a leap year
  4. */
  5. function isLeapYear(fullYear){
  6. if (isDate(fullYear)) {
  7. fullYear = fullYear.getFullYear();
  8. }
  9. return fullYear % 400 === 0 || (fullYear % 100 !== 0 && fullYear % 4 === 0);
  10. }
  11. module.exports = isLeapYear;