Skip to main content
Home

@std/datetime@0.225.6
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 days ago (0.225.6)

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
SECOND

The number of milliseconds in a second.

T
Unit

Duration units for DifferenceFormat and DifferenceOptions.

v
WEEK

The number of milliseconds in a week.

f
weekOfYear

Returns the ISO week number of the provided date (1-53).

v
DAY

The number of milliseconds in a day.

v
HOUR

The number of milliseconds in an hour.

v
MINUTE

The number of milliseconds in a minute.

v
SECOND

The number of milliseconds in a second.

v
WEEK

The number of milliseconds in a week.

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.

T
Unit

Duration units for DifferenceFormat and DifferenceOptions.

f
format

Formats a date to a string with the specified format.

I
FormatOptions

Options for format.

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.

f
parse

Parses a date string using the specified format string.

f
weekOfYear

Returns the ISO week number of the provided date (1-53).

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.