@writetome51/is-leap-year
v0.0.1
Published
Pass in a year (an integer, not a Date). Returns true if it's a leap year, false if not
Downloads
6
Maintainers
Readme
isLeapYear(year: number): boolean
year
must be a number.
Examples
isLeapYear(2020); // --> true
isLeapYear(2021); // --> false
isLeapYear(2024); // --> true
isLeapYear(0); // --> true
isLeapYear(1600); // --> true
isLeapYear(1700); // --> false
isLeapYear(996); // --> true
isLeapYear(1000); // --> false
isLeapYear(NaN); // --> false
isLeapYear(''); // `Error: Input must be type 'number'`
Installation
npm i @writetome51/is-leap-year
Loading
import { isLeapYear } from '@writetome51/is-leap-year';