Skip to main content
Home

@std/datetime@0.225.5
Built and signed on GitHub Actions

UNSTABLE: Utilities for dealing with Date objects

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
6 months ago (0.225.5)

Utilities for dealing with Date objects.

import { dayOfYear, isLeap, difference, HOUR, MINUTE, SECOND } from "@std/datetime";
import { assertEquals } from "@std/assert";

assertEquals(dayOfYear(new Date("2019-03-11T03:24:00")), 70);
assertEquals(isLeap(1970), false);

const date0 = new Date("2018-05-14");
const date1 = new Date("2020-05-13");
assertEquals(difference(date0, date1).years, 1);

assertEquals(HOUR / MINUTE, 60);
assertEquals(MINUTE / SECOND, 60);
Built and signed on
GitHub Actions

New Ticket: 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 * as datetime from "@std/datetime";
or

Import directly with a jsr specifier

import * as datetime from "jsr:@std/datetime";

Add Package

pnpm i jsr:@std/datetime
or (using pnpm 10.8 or older)
pnpm dlx jsr add @std/datetime

Import symbol

import * as datetime from "@std/datetime";

Add Package

yarn add jsr:@std/datetime
or (using Yarn 4.8 or older)
yarn dlx jsr add @std/datetime

Import symbol

import * as datetime from "@std/datetime";

Add Package

vlt install jsr:@std/datetime

Import symbol

import * as datetime from "@std/datetime";

Add Package

npx jsr add @std/datetime

Import symbol

import * as datetime from "@std/datetime";

Add Package

bunx jsr add @std/datetime

Import symbol

import * as datetime from "@std/datetime";