UNPKG

@technobuddha/library

Version:
22 lines (21 loc) 855 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.isLeapYear = void 0; var isNumber_1 = __importDefault(require("lodash/isNumber")); /** * Determine if a year is a leap year * * @param input A date, or a year number * @param __namedParameters see {@link Options} * @returns true, if the specified year is a leap year */ function isLeapYear(input, _a) { var _b = _a === void 0 ? {} : _a, _c = _b.UTC, UTC = _c === void 0 ? false : _c; var year = isNumber_1.default(input) ? input : UTC ? input.getUTCFullYear() : input.getFullYear(); return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); } exports.isLeapYear = isLeapYear; exports.default = isLeapYear;