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. Updating month or year without day clamps an overflowing day to the end of the target 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 start on firstDay, the configured weekStart from configure(), or this date’s active locale.
Parameters
unitDateUnitrequired
Calendar unit from 'year' down to 'day'.
firstDayDayOfWeek
First day of the week when rounding to a week, such as 'sunday' or 7.
Returns the first day of the calendar unit after the one containing this date. The result is always a later date, so from December 1 the next month starts on January 1.
Pass a weekday name in place of a unit to get the next day with that name, the same date next() returns.
Parameters
unitDateUnit | Exclude<DayOfWeek, number>required
Calendar unit from 'year' down to 'day', or a weekday name such as 'wednesday'.
firstDayDayOfWeek
First day of the week when unit is 'week'.
Returns
CalendarDate
The first calendar day of the next unit, or the next given weekday.
Returns the first day of the calendar unit before the one containing this date. A weekday name in place of a unit gives the most recent day with that name, as previous() does.
Parameters
unitDateUnit | Exclude<DayOfWeek, number>required
Calendar unit from 'year' down to 'day', or a weekday name such as 'wednesday'.
firstDayDayOfWeek
First day of the week when unit is 'week'.
Returns
CalendarDate
The first calendar day of the previous unit, or the previous given weekday.
Moves forward to the next given weekday or MonthDay after this date. When already on that weekday or annual date, it advances to the following occurrence.
Parameters
targetDayOfWeek | MonthDayrequired
Weekday name such as 'friday', ISO number from 1 to 7, or recurring MonthDay.
Moves back to the most recent given weekday or MonthDay before this date. When already on that weekday or annual date, it steps back to the prior occurrence.
Parameters
targetDayOfWeek | MonthDayrequired
Weekday name, three-letter prefix, ISO number from 1 to 7, or recurring MonthDay.
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
Working day vs. weekend day in the active locale, such as Saturday and Sunday in en-US or Friday and Saturday in ar-SA.
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 counted in days, or a number when unit is given.
Creates an inclusive DateRange starting on this date and running through the end date or span length. Both the start day and end day are included. Also aliased as through(); use for() to pass an explicit duration length (refusing endpoints and unitless numbers).
d.every(step, zone?): DateTime[]d.every(count, unit, zone?): DateTime[]
Walks through this calendar day by a positive step in the given or configured time zone, returning an array of DateTime moments starting at midnight. Daylight saving transitions produce 23 or 25 hourly points automatically.
Parameters
stepUnit | DurationInput | numberrequired
Unit name such as 'hour', duration such as '30m', or numeric count paired with unit.
unitUnit
Unit name when the first argument is a numeric count.
zoneZone
Time zone for the day's boundaries, defaulting to the configured zone.
Formats the date using built-in presets, custom names from configure(), options objects, or token patterns.
Localized presets from 'L' through 'LLLL' are built in, and options objects ignore clock and zone keys automatically. See Formatting for the full preset and token reference.
Parameters
specFormatSpecdefault 'medium'
Built-in or configured format name, Intl options object, or token pattern.
localestring
BCP 47 locale tag overriding this date's or the configured locale for one call.
Formats the calendar distance from another date to this one as a localized phrase via Intl.RelativeTimeFormat, such as 'yesterday' or 'in 3 weeks'.
Omitting the first argument compares against today(), and formatRelative() works as an alias. Distances under seven days use natural words for yesterday, today, and tomorrow, while weeks, months, and years use numeric counts.
Parameters
otherCalendarDateInput
Reference calendar date to measure from. Defaults to today() in the active zone.
localeLocale
BCP 47 locale tag overriding this date's or the configured locale for one call.
Reads the locale carried on this date, or returns a copy that formats and starts weeks in another locale across presets, week boundaries, and derived values. Underscore tags and Accept-Language headers normalize automatically, an empty tag clears it, and lang() is an alias.
Parameters
tagLocale | null | undefined
Locale tag, tag array, or Accept-Language header to carry forward, or null to clear it.
Returns
CalendarDate | Locale | undefined
The active tag when called with no arguments, or a new CalendarDate carrying tag.
const trip = date('2026-05-15').locale('fr-FR');trip.locale(); // 'fr-FR'trip.format('long'); // '15 mai 2026'trip.to('2026-05-19').format('long'); // '15–19 mai 2026'
Converts this date to another kind inside a method chain, including YearMonth and MonthDay. Converting to a moment returns midnight at the start of this date in the given or configured zone.