Create an instance from an ISO string, year-month-day numbers, or an existing value with date(), or read the current day with today(). Helpers for tomorrow and yesterday work the same way, and every method returns a new immutable instance.
Because a calendar date has no clock or time zone, May 10 stays May 10 for every user regardless of where they live. You can also read the local calendar date off any DateTime:
Returns a new CalendarDate with one or more calendar fields replaced. Out-of-range dates such as February 30 throw a RangeError instead of rolling into the next month.
Parameters
fieldsDateTimeFields | DateUnitrequired
Object with year, month, or day fields, or a single unit name.
Step across calendar units, snap to period boundaries, or move to a nearby weekday. Clock units such as hours and minutes throw a RangeError because a calendar date has no clock.
Month-end clamping
Adding months or years clamps to the last valid day of the target month rather than overflowing into the next one. Adding one month to January 31 lands on February 28, or February 29 in a leap year.
Returns the first day of the calendar unit containing this date. Week boundaries begin on Monday unless configured otherwise with configure() or overridden with firstDay.
Parameters
unitDateUnitrequired
Calendar unit from 'year' down to 'day'.
firstDayWeekday
First day of the week when rounding to a week, such as 'sunday' or 7.
Compare calendar dates directly or pass any input accepted by date().
Avoid numeric comparison operators
A calendar date is not a timestamp, so numeric operators throw a RangeError rather than coercing to milliseconds. Compare dates with methods like isBefore(), or sort arrays with compare().
equals()
d.equals(other): boolean
Returns true when both values represent the same calendar year, month, and day.
Parameters
otherCalendarDateInputrequired
Another CalendarDate or any input accepted by date().
Returns
boolean
true if both values represent the same calendar day.
const due = date('2026-11-16');due.equals('2026-11-16'); // truedue.equals(date(2026, 11, 16)); // true
isBefore()
d.isBefore(other): boolean
Returns true if this date is earlier on the calendar than the other.
Returns true if this date is later on the calendar than the other.
date('2026-11-17').isAfter('2026-11-16'); // true
isSame()
d.isSame(other, unit?, firstDay?): boolean
Checks whether another date falls in the same calendar unit, such as the same month or week. Calling isSame() without a unit checks whether both values are the exact same day.
Parameters
otherCalendarDateInputrequired
Date to compare against.
unitDateUnit
Calendar unit to compare, from 'year' down to 'day'.
Relative day checks accept an optional time zone because which calendar day is today depends on where you stand. When omitted, they use the default zone from configure().
Whether this date matches today, tomorrow, or yesterday in the given or configured zone.
isPast(zone?), isFuture(zone?)
boolean
Whether this date is earlier or later than today in the given or configured zone.
isWeekday(), isWeekend()
boolean
Monday through Friday vs. Saturday and Sunday.
isLeapYear()
boolean
Whether this date’s year has 366 days.
Measuring spans
until()
d.until(other): Durationd.until(other, unit): number
Measures the calendar span from this date to another, returning a negative duration when the target is earlier. The returned Duration remembers this starting date so months and years can be totaled accurately.
Parameters
otherCalendarDateInputrequired
Target date to measure toward.
unitUnit
Unit to return the total length in as a floating-point number.
Returns
Duration | number
A Duration balanced up to years, or a number when unit is given.