import { CalendarDate } from '@internationalized/date'; import type { DateValue } from '@internationalized/date'; /** * A calendar date as `YYYY-MM-DD` — no time, no timezone, no offset. * * This is an alias for `string`, so it documents rather than enforces. The * runtime enforcement is in `toCalendarDate`, which throws on a malformed * value instead of silently rendering an empty field. */ export type IsoDate = string; /** * ISO string in, `CalendarDate` out. Throws on anything else. * * THROWING IS THE POINT. The tempting alternative is to return `null` for an * unparseable value, and the first version did. A caller who passed a * `Date`, a timestamp or `'04/12/2026'` then got a date picker that rendered * perfectly with nothing in it, and no indication anywhere that the value it * was handed had been dropped on the floor. An exception names the prop and the * value, which is the difference between a five-second fix and an afternoon. * * `parseDate` is also stricter than it looks: it rejects `2026-02-30` and * `2026-13-01`, so a date that is well-formed but does not exist fails here * too rather than being quietly rounded into a neighbouring month. */ export declare function toCalendarDate(value: IsoDate | null | undefined, prop: string): CalendarDate | null; /** * `CalendarDate` out, ISO string back. * * `toString()` is NOT used, and this is not a stylistic preference. A value * that came from a non-Gregorian calendar stringifies WITH its calendar * annotation — `2569-05-30[u-ca-buddhist]` — which is a correct ISO 8601-2 * string and is not what any caller expecting `YYYY-MM-DD` will do anything * sensible with. Building the string from the parts of the Gregorian * projection is what keeps the wire format one shape in every locale. * * The projection to Gregorian happens here rather than being assumed. In * practice react-aria hands back the calendar it was given — `useCalendarState` * converts through `toCalendar` on the way out — so a Gregorian value in is a * Gregorian value out, and this is a no-op. It is written anyway because the * one path where it is NOT a no-op is an unavailable-date predicate being * offered a cell from the DISPLAY calendar, which is the reader's, not ours. */ export declare function toIso(date: DateValue): IsoDate; /** * Wraps an `isDateUnavailable` predicate so the caller receives an ISO string * rather than a `CalendarDate`. * * Returned as `undefined` when there is no predicate, rather than as a function * that always returns false. react-aria checks for the prop's presence in more * than one place, and a no-op function is present. */ export declare function wrapUnavailable(fn: ((date: IsoDate) => boolean) | undefined): ((date: DateValue) => boolean) | undefined; //# sourceMappingURL=iso-date.d.ts.map