export type SegmentType = "year" | "month" | "day" | "hour" | "minute" | "dayPeriod"; /** Keys match {@link SegmentType}. */ export interface SegmentLabels { year: string; month: string; day: string; hour: string; minute: string; dayPeriod: string; } /** What an empty segment prompts: the letters of the digits it takes, in every language, as a date * reads `dd/MM/yyyy` in every language. */ export declare const SEGMENT_PLACEHOLDERS: SegmentLabels; export type LayoutSegment = { kind: "field"; type: SegmentType; } | { kind: "literal"; value: string; }; export interface DateLayout { /** Locale display order. */ segments: LayoutSegment[]; hour12: boolean; /** Only meaningful when hour12. */ amText: string; pmText: string; } /** `hour` is canonical 0–23 regardless of display. */ export interface SegmentBuffer { year: number | null; month: number | null; day: number | null; hour: number | null; minute: number | null; } export declare function emptyBuffer(): SegmentBuffer; /** Exported so the segments and `time_options` agree on 12/24-hour. */ export declare const TIME_FORMAT_OPTIONS: Intl.DateTimeFormatOptions; export declare function getDateLayout(locale: string, hasTime: boolean): DateLayout; export declare function getTimeLayout(locale: string): DateLayout; /** Literals dropped. */ export declare function fieldOrder(layout: DateLayout): SegmentType[]; export declare function to12h(hour24: number): { h12: number; pm: boolean; }; export declare function from12h(h12: number, pm: boolean): number; export interface DigitResult { text: string; /** Display domain: 1–12 for `hour` in 12h mode. */ value: number; /** Full: focus advances. */ complete: boolean; } export declare function typeDigit(type: SegmentType, currentText: string, digit: string, hour12: boolean): DigitResult; /** * A lone "1" might be "12", so a typed separator is the explicit advance; a leading one is a no-op, * as in native date inputs. */ export declare function separatorAdvances(key: string, segmentHasContent: boolean): boolean; /** Wrapping within range. */ export declare function incrementSegment(type: SegmentType, current: number | null, delta: number, hour12: boolean): number; export declare function setHourField(buffer: SegmentBuffer, typed: number, hour12: boolean): number; /** Preserving the displayed 12-hour value. */ export declare function withDayPeriod(buffer: SegmentBuffer, pm: boolean): number; /** Null when unset. */ export declare function displayValue(type: SegmentType, buffer: SegmentBuffer, layout: DateLayout): string | null; export declare function valueToSegments(iso: string, hasTime: boolean): SegmentBuffer; export declare function isBufferEmpty(buffer: SegmentBuffer, hasTime: boolean): boolean; /** Null when incomplete or invalid. */ export declare function segmentsToValue(buffer: SegmentBuffer, hasTime: boolean): string | null; export interface SegmentsConfig { layout: DateLayout; toBuffer: (value: string) => SegmentBuffer; toValue: (buffer: SegmentBuffer) => string | null; isEmpty: (buffer: SegmentBuffer) => boolean; /** Null when unparseable. */ parse: (text: string) => string | null; } export declare function dateSegmentsConfig(locale: string, hasTime: boolean): SegmentsConfig; /** Unparseable or out of range reads as empty. */ export declare function timeToSegments(time: string): SegmentBuffer; /** Null while either half is missing. */ export declare function segmentsToTime(buffer: SegmentBuffer): string | null; export declare function timeSegmentsConfig(locale: string): SegmentsConfig;