This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
admin-panel/graphql-types/node_modules/date-fns/is_leap_year/index.js

25 lines
604 B
JavaScript

var parse = require('../parse/index.js')
/**
* @category Year Helpers
* @summary Is the given date in the leap year?
*
* @description
* Is the given date in the leap year?
*
* @param {Date|String|Number} 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 (dirtyDate) {
var date = parse(dirtyDate)
var year = date.getFullYear()
return year % 400 === 0 || year % 4 === 0 && year % 100 !== 0
}
module.exports = isLeapYear