Skip to main content

@std/datetime@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score70%
Published2 years ago (0.215.0)
function isUtcLeap
isUtcLeap(year: Date | number): boolean

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 "@std/datetime/is_leap";

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 in number or Date format

Return Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/datetime

Import symbol

import { isUtcLeap } from "@std/datetime";
or

Import directly with a jsr specifier

import { isUtcLeap } from "jsr:@std/datetime";