Docs
/
dates

Dates

Compare dates, show relative time, and measure durations. Helpful helpers when Intl alone is not quite enough.

timeFrom

Link Copied!

Calendar Y/M/D via Intl so local and timeZone-aware callers share one path. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts

timeFrom("2025-06-15T12:00")
1 year ago
Result

timeDifference

Link Copied!

Format a duration segment with Intl unit style (locale-aware pluralization). https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat

timeDifference("2025-01-01T00:00", "2025-01-11T00:00")
10 days
Result

combineDates

Link Copied!

combineDates("2025-01-01T10:00:00", "2025-01-31T14:30:00")
1-31 January 2025
Result

isToday

Link Copied!

isToday("2025-06-15T12:00")
false
Result

isPast

Link Copied!

Check if a date is in the past.

isPast("2020-01-01T12:00")
true
Result

isFuture

Link Copied!

Check if a date is in the future

isFuture("2030-01-01T12:00")
true
Result

isSameDay

Link Copied!

Check if two dates fall on the same calendar day in local time.

isSameDay("2025-06-15T08:00", "2025-06-15T20:00")
true
Result

isSameMonth

Link Copied!

Check if two dates fall in the same calendar month in local time.

isSameMonth("2025-06-01T08:00", "2025-06-28T20:00")
true
Result

isDateBetween

Link Copied!

Check if a date falls between a start and end date by timestamp.

isDateBetween("2025-06-15T12:00", "2025-06-01T00:00", "2025-06-30T00:00")
true
Result