Function isUtcLeap
- is
Utc (year): booleanLeap Parameters
- year: number | Date
The year in number or
Dateformat.
Returns boolean
trueif the given year is a leap year;falseotherwise.Example: Basic usage
import { isUtcLeap } from "@std/datetime/is-leap";
import { assertEquals } from "@std/assert";
assertEquals(isUtcLeap(new Date("2000-01-01")), true);
assertEquals(isUtcLeap(new Date("December 31, 1999 23:59:59 GMT-01:00")), true);
assertEquals(isUtcLeap(2000), true);
assertEquals(isUtcLeap(1999), false);- year: number | Date
Returns whether the given year is a leap year in UTC time. This always returns the same value regardless of the local timezone.
This is based on https://docs.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year.