Skip to main content
Home
This release is 8 versions behind 0.225.6 — the latest version of @std/datetime. Jump to latest

@std/datetime@0.224.4
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
a year ago (0.224.4)

default

Utilities for dealing with Date objects.

v
DAY

The number of milliseconds in a day.

f
dayOfYear

Returns the number of the day in the year in the local time zone.

f
dayOfYearUtc

Returns the number of the day in the year in UTC time.

f
difference

Calculates the difference of the 2 given dates in various units. If the units are omitted, it returns the difference in the all available units.

T
DifferenceFormat

Return type for difference.

T
DifferenceOptions

Options for difference.

f
format

Formats a date to a string with the specified format.

I
FormatOptions

Options for format.

v
HOUR

The number of milliseconds in an hour.

f
isLeap

Returns whether the given year is a leap year. Passing in a Date object will return the leap year status of the year of that object and take the current timezone into account. Passing in a number will return the leap year status of that number.

f
isUtcLeap

Returns whether the given year is a leap year in UTC time. This always returns the same value regardless of the local timezone.

v
MINUTE

The number of milliseconds in a minute.

f
parse

Parses a date string using the specified format string.

v