import { isLeap } from "https://deno.land/std@0.171.0/datetime/mod.ts";
Returns whether the given date or year (in number) is a leap year or not. based on: https://docs.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year
Examples
Example 1
Example 1
import { isLeap } from "https://deno.land/std@0.171.0/datetime/is_leap.ts";
isLeap(new Date("1970-01-01")); // => returns false
isLeap(new Date("1972-01-01")); // => returns true
isLeap(new Date("2000-01-01")); // => returns true
isLeap(new Date("2100-01-01")); // => returns false
isLeap(1972); // => returns true
Parameters
year: Date | number
year in number or Date format