Skip to main content
Module

std/datetime/is_leap.ts>isUtcLeap

Deno standard library
Go to Latest
function isUtcLeap
import { isUtcLeap } from "https://deno.land/std@0.183.0/datetime/is_leap.ts";

Returns whether the given date or year (in number) is a leap year or not in UTC time. This always returns the same value regardless of the local timezone. based on: https://docs.microsoft.com/en-us/office/troubleshoot/excel/determine-a-leap-year

Examples

Example 1

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

isUtcLeap(2000); // => returns true regardless of the local timezone
isUtcLeap(new Date("2000-01-01")); // => returns true regardless of the local timezone
isUtcLeap(new Date("January 1, 2000 00:00:00 GMT+00:00")); // => returns true regardless of the local timezone
isUtcLeap(new Date("December 31, 2000 23:59:59 GMT+00:00")); // => returns true regardless of the local timezone
isUtcLeap(new Date("January 1, 2000 00:00:00 GMT+01:00")); // => returns false regardless of the local timezone
isUtcLeap(new Date("December 31, 2000 23:59:59 GMT-01:00")); // => returns false regardless of the local timezone
isUtcLeap(new Date("January 1, 2001 00:00:00 GMT+01:00")); // => returns true regardless of the local timezone
isUtcLeap(new Date("December 31, 1999 23:59:59 GMT-01:00")); // => returns true regardless of the local timezone

Parameters

year: Date | number

year in number or Date format

Returns

boolean