Skip to main content
Module

std/datetime/is_leap.ts>isUtcLeap

The Deno Standard Library
Latest
function isUtcLeap
import { isUtcLeap } from "https://deno.land/std@0.223.0/datetime/is_leap.ts";

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.

Examples

Basic usage

import { isUtcLeap } from "https://deno.land/std@0.223.0/datetime/is_leap.ts";

isUtcLeap(new Date("2000-01-01")); // true

isUtcLeap(new Date("December 31, 1999 23:59:59 GMT-01:00")); // true

isUtcLeap(2000); // true

isUtcLeap(1999); // false

Parameters

year: Date | number

The year in number or Date format.

Returns

boolean

true if the given year is a leap year; false otherwise.