Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
variable isLeapYear
import { isLeapYear } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";

Returns true if the given year is a leap year, false otherwise.

Use new Date(), setting the date to February 29th of the given year and use Date.prototype.getMonth() to check if the month is equal to 1.

type

(year: number) => unknown