/** * Date formatting and parsing utilities for DatePicker. * Uses native Intl.DateTimeFormat — no external dependencies. * * @internal Engine functions are an internal API of the DatePicker * component. They are exported for testing and re-use by sibling * components in this package but are not part of the public surface; * the supported entry points are the `DatePicker` and `DateRangePicker` * Svelte components themselves. */ import type { DateRange } from '../Calendar/calendar.types.js'; export type DateFormatOptions = Intl.DateTimeFormatOptions; /** * Format a Date as a locale-aware string. Guards Invalid Date and Intl * errors with logging instead of silent fallback. */ export declare function formatDateInput(date: Date, locale: string, options?: DateFormatOptions): string; /** * Format a date range. Deliberately concatenates the two halves with a * fixed " – " (U+2013, en-dash with spaces) separator instead of * `Intl.DateTimeFormat#formatRange`. The native API would collapse * shared components (year/month) and break round-trip parsing — the * range "Mar 15 – 22, 2026" cannot be split back into two valid dates * because the first half has no year. The fixed separator keeps * `formatDateRangeInput` and `parseDateRangeInput` symmetric. */ export declare function formatDateRangeInput(start: Date, end: Date, locale: string, options?: DateFormatOptions): string; /** * Parse a single date from user input. Tries the locale's formatted mask * first (built via `Intl.DateTimeFormat#formatToParts`), then a strict * YYYY-MM-DD ISO fallback parsed in LOCAL timezone. Returns `null` for * anything that can't be unambiguously parsed. * * Supports any locale whose default mask is purely numeric (day, month, * year). Locales with non-numeric month names (`month: 'long'`), * weekday literals, or non-Gregorian calendars are NOT parseable — the * caller should rely on calendar-picker UX or accept ISO input only. */ export declare function parseDateInput(input: string, locale: string, options?: DateFormatOptions): Date | null; /** * Parse a date range string like "15.03.2026 – 22.03.2026". Splits on * the locale-aware range separator and parses each half with `parseDateInput`. * A single date with no separator is accepted as a single-day range * (`{ start: d, end: d }`). Rejects inverted ranges (start after end). */ export declare function parseDateRangeInput(input: string, locale: string, options?: DateFormatOptions): DateRange | null; export interface DateConstraints { minDate?: Date; maxDate?: Date; disabledDates?: Date[]; isDateDisabled?: (date: Date) => boolean; } /** * Centralised predicate that respects min/max/disabledDates/isDateDisabled. * Used by both calendar clicks and typed input so they validate identically. * * Defensive against bad inputs: * - Invalid `minDate` / `maxDate` are ignored with a warning instead of * silently disabling the constraint. * - Invalid entries in `disabledDates` are skipped with a warning. * - Throws from `isDateDisabled` are caught and logged; the date is * then treated as allowed so a faulty predicate can't take the picker * down. * * Note: if `minDate > maxDate` after stripping time, every date is * out-of-range. We warn once on that configuration to surface the bug. */ export declare function isDateAllowed(date: Date, constraints: DateConstraints): boolean;