View on GitHub

Localization and utilities

This reference covers locale and message registries, date and range helpers, and public errors. Start with the API overview to find another contract area.

Localization contracts

CalendarLocale is a supported name or date-fns Locale. The constant DEFAULT_CALENDAR_LOCALE is "en-US". calendarLocaleNames is the frozen, sorted list accepted by the built-in lazy registry.

CalendarFormatters

Every callback receives { locale, view }.

FormatterInputDefault result
timeone datelocale short time (9:00 AM)
dateone datelocale full date
weekdayone dateabbreviated weekday
dayHeaderone dateview-specific day number/full date/weekday form
rangeHeaderresolved rangeview-specific month, date, or date-span React content

The registry is complete and immutable. Extend it outside render:

const formatters = {
    ...defaultCalendarFormatters,
    time: (date: Date, { locale }: CalendarFormatContext) =>
        format(date, "HH:mm", { locale })
};

CalendarMessages

MessageContext fieldsPurposeExample result
previous, nextview, rangeNavigation accessible label"Next week"
timeGridLabel, monthGridLabelviewScrollable grid accessible name"Week calendar"
multiDayRegionLabelviewVisible and accessible dedicated-region label"Multi-day events"
slotLabelview, prepared date, prepared timeSelectable slot label"Monday, September 14 at 9:00 AM"
eventLabelview, optional title/description, prepared start/end date/timeEvent details tooltip and interactive label"Planning, Monday, 9:00 AM to 10:00 AM"
eventMoveHandleview, optional titleAccessible movement description for a movable event"Move Planning"
eventMoveTargetview, optional title/resource, prepared date/timeLive movement destination announcement"Move Planning to Tuesday, 10:00 AM, Studio"
eventResizeHandleview, edge, optional title, prepared date/timeAccessible resize-handle label"Resize end of Planning, Monday at 10:00 AM"
timeRangeview, prepared start/end timeVisible event time text"9:00 AM – 10:00 AM"
agendaEmptyview, rangeAgenda empty state"No events in this range."
moreEventsview, count, prepared dateMonth overflow control"Show 3 more events for September 14"

The default registry is immutable English application text. Locale-specific date values are already prepared before message functions run.

Date functions

FunctionSignature summaryResult and errorsExample
parseCalendarDate(CalendarDateInput) => DateClones/parses; invalid input returns an invalid Date.parseCalendarDate("2026-09-14")
asCalendarDate(input, timeZone?) => DateParses, validates, and attaches a wall-clock zone. Throws TypeError when invalid.asCalendarDate("2026-09-14", "UTC")
toCalendarTimeZone(date, timeZone?) => DateAttaches an IANA zone while preserving visible fields; does not preserve the instant.toCalendarTimeZone(new Date(2026, 8, 14, 9), "Asia/Tokyo")
calendarDateFromTimestamp(milliseconds, timeZone?) => DatePreserves the instant and derives visible fields in the zone.calendarDateFromTimestamp(Date.now(), "UTC")

Field-level date setters are implementation details. Consumers should pass CalendarDateInput values to components or use the normalization functions above when a concrete calendar Date is required.

Locale functions

FunctionBehaviorErrorsExample
resolveCalendarLocaleNameCanonicalizes aliases, scripts, regions, then language fallbacks to one registry key.TypeError for empty/non-string; RangeError for invalid or unsupported names.resolveCalendarLocaleName("en") // "en-US"
loadCalendarLocaleLoads and caches a supported named locale, or validates and resolves an object immediately. Concurrent loads share a promise.TypeError, RangeError, or Error when dynamic import fails.await loadCalendarLocale("en-CA")
preloadCalendarLocaleAlias of loadCalendarLocale, named for pre-render use.same as aboveawait preloadCalendarLocale("en-AU")

Range function

FunctionBehaviorErrorsExample
resolveCalendarRangeResolves days and navigation into one ResolvedCalendarRange. The result exposes start, end, days, and navigate(direction).TypeError for unsupported/ambiguous definitions or invalid custom navigation; RangeError for empty/invalid ranges or steps.resolveCalendarRange("week", anchor, { weekStartsOn: 1 })

Range construction, bounds extraction, and movement helpers stay private. Consumers describe ranges with CalendarRangeDefinition; custom view code can call resolveCalendarRange when it needs the normalized days and navigation contract outside a built-in view.

Error reference

AreaInvalid inputError
Root viewunregistered viewError
Dates/eventsinvalid date input or event boundaryTypeError
Navigation boundariesinvalid minDate/maxDate, or minDate after maxDateTypeError or RangeError
Selectioninvalid selected day/range boundary, or an end not after its startTypeError or RangeError
Localeempty/malformed object/nameTypeError or RangeError
Locale loadingfailed dynamic moduleError with the original cause
Rangesinvalid/ambiguous definition, boundary, count, navigation strategy/result, direction, or empty resultTypeError or RangeError
Resourcesmissing/invalid/duplicate IDs or non-array assignmentsTypeError or RangeError
Time windowmalformed HH:mm or maxTime <= minTimeTypeError or RangeError
Time scalenon-positive slot duration or incompatible label intervalRangeError
Slot sizingconflicting, non-finite, negative, or zero fixed sizeRangeError
Groupingvalue other than day or resource at runtimeTypeError

Errors are raised during helper invocation or component render. Error messages are useful diagnostics, but the error class and documented validity rules are the stable contract.