Skip to main content
Home

small date utilities

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
9 months ago (0.1.3)
f
addDays

adds a specified number of days to a date.

f
addHours

adds a specified number of hours to a date.

f
addMilliseconds

adds a specified number of milliseconds to a date.

f
addMinutes

adds a specified number of minutes to a date.

f
addMonths

adds a specified number of months to a date.

f
addSeconds

adds a specified number of seconds to a date.

f
addYears

adds a specified number of years to a date.

f
clamp

clamps a date between a minimum and maximum range.

f
cloneDate

creates a copy of a given date.

f
compareLocalAsc

compares two dates and returns a number indicating their relative order, in local time.

f
compareUtcAsc

compares two dates and returns a number indicating their relative order, in UTC time.

T
DayOfWeek

represents a day of the week as a numeric value (0 = Sunday, 6 = Saturday).

f
differenceInCalendarDays

calculates the difference in calendar days between two dates.

f
differenceInCalendarMonths

calculates the difference in calendar months between two dates.

f
differenceInCalendarWeeks

calculates the difference in calendar weeks between two dates.

f
differenceInCalendarYears

calculates the difference in calendar years between two dates.

f
differenceInDays

calculates the difference in days between two dates.

f
differenceInHours

calculates the difference in hours between two dates.

f
differenceInMilliseconds

calculates the difference in milliseconds between two dates.

f
differenceInMinutes

calculates the difference in minutes between two dates.

f
differenceInMonths

calculates the difference in months between two dates.

f
differenceInSeconds

calculates the difference in seconds between two dates.

f
differenceInWeeks

calculates the difference in weeks between two dates.

f
differenceInYears

calculates the difference in years between two dates.

f
endOfDay

returns the end of the day for a given date.

f
endOfMonth

returns the end of the month for a given date.

f
endOfWeek

returns the end of the week for a given date.

f
endOfYear

returns the end of the year for a given date.

f
getDayOfMonth

returns the day of the month for a given date.

f
getDayOfWeek

returns the day of the week for a given date (0 = Sunday, 6 = Saturday).

f
getHours

returns the hours portion of a given date.

f
getMilliseconds

returns the milliseconds portion of a given date.

f
getMinutes

returns the minutes portion of a given date.

f
getMonth

returns the month portion of a given date (0 = January, 11 = December).

f
getSeconds

returns the seconds portion of a given date.

f
getYear

returns the year portion of a given date.

f
isAfterDate

checks if a date is after another date.

f
isBeforeDate

checks if a date is before another date.

f
isSameCalendarDate

checks if two dates fall on the same calendar day.

f
isSameCalendarMonth

checks if two dates fall in the same calendar month.

f
isSameCalendarYear

checks if two dates fall in the same calendar year.

f
isSameDate

checks if two dates are exactly the same.

f
max

returns the later of two dates.

f
min

returns the earlier of two dates.

f
nextDay

returns the next occurrence of a specific day of the week.

f
previousDay

returns the previous occurrence of a specific day of the week.

f
startOfDay

returns the start of the day for a given date.

f
startOfMonth

returns the start of the month for a given date.

f
startOfWeek

returns the start of the week for a given date.

f
startOfYear

returns the start of the year for a given date.

f
toISODateString

converts a date to an ISO 8601 date string (YYYY-MM-DD) in local timezone

f
toISODateTimeString

converts a date to an ISO 8601 datetime string (YYYY-MM-DDTHH:mm:ss.sss) in local timezone

f
toUnixMilliseconds

returns the Unix timestamp in milliseconds for a given date.

f
toUnixSeconds

returns the Unix timestamp in seconds for a given date

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.