import Type, { type TSchemaOptions } from "typebox"; /** How much of a calendar date is known. */ export type TCalendarDatePrecision = "year" | "month" | "day"; /** A calendar date read into its parts. */ export interface TCalendarDateParts { year: number; month?: number; day?: number; precision: TCalendarDatePrecision; } /** * Creates a {@link CalendarDate} schema, with any extra schema options (such * as a `description`). * * The value is an ISO 8601 calendar date at one of three precisions: * `"1787"`, `"1787-11"` or `"1787-11-22"`. It is a plain string, so it * encodes, hashes and round-trips as itself. The whole check is a * refinement, not only the `pattern`: a schema whose `pattern` has been * stripped (the relaxed IEEE schemas) still refuses `"87"` or `"1787-13"`. */ export declare function calendarDateType(options?: TSchemaOptions): Type.TRefine; /** TypeBox type of a calendar date: a year, a year and month, or a day. */ export declare const CalendarDate: Type.TRefine; /** * Reads a calendar date into its parts. * * @throws TypeError when `value` is not a valid calendar date. */ export declare function parseCalendarDate(value: string): TCalendarDateParts; /** * The calendar date of an instant, read in `timeZone` and cut to * `precision`. * * `value` is a `Date`, or the ISO string a `Date` is written as by * `JSON.stringify`, which names its zone. With the default zone, `"UTC"`, it * gives the day a citation date stored as midnight UTC of that day means. * Pass the zone the value was written in to recover a day stored at local * midnight. * * A string that is already a calendar date comes back as it is, cut to * `precision` only when it is longer, so converting a partly converted store * twice changes nothing and never invents a month or day. * * @throws TypeError when `value` is neither a valid instant nor a calendar * date, including a date-time string that names no zone or names a day or * time that does not exist. * @throws RangeError when the year falls outside 0000-9999, or `timeZone` * is not a time zone `Intl.DateTimeFormat` knows. */ export declare function calendarDateFromInstant(value: Date | string, precision?: TCalendarDatePrecision, timeZone?: string): string; //# sourceMappingURL=calendar-date.d.ts.map