/** * Internal, calendar-agnostic date representations. * * By default the library uses the Gregorian calendar, but we also support * the Persian (Jalali) calendar via a thin adapter layer. */ export type OnlyDateFormat = string; export type OnlyDateUnits = { date: number; month: number; year: number; }; export type DateUnitType = 'date' | 'month' | 'year'; export type DateLocale = { locale: string; }; export type CalendarType = 'gregorian' | 'persian'; export type CalendarAdapter = { calendar: CalendarType; /** * Convert calendar-specific date string (YYYY-MM-DD) to calendar units. */ toUnits: (date: OnlyDateFormat) => OnlyDateUnits; /** * Convert calendar units to a calendar-specific date string (YYYY-MM-DD). */ toOnlyDateFormat: (units: OnlyDateUnits) => OnlyDateFormat; /** * Convert calendar units to a real JS Date for comparison / clamping. */ toDate: (units: OnlyDateUnits) => Date; /** * Number of days in a given month of a given year for this calendar. */ getDaysInMonth: (year: number, month: number) => number; /** * Localized month names (index 0-11). */ getLocalizedMonthNames: (locale: string) => string[]; /** * Order of date units based on locale (e.g. ['year','month','date']). */ getSortedDateUnitPositions: (locale: string) => DateUnitType[]; }; export declare const GregorianCalendarAdapter: CalendarAdapter; export declare const PersianCalendarAdapter: CalendarAdapter; export declare const getCalendarAdapter: (calendar: CalendarType) => CalendarAdapter; export declare const DateUtils: { MONTH_COUNT: number; toUnits: (date: OnlyDateFormat | Date) => OnlyDateUnits; toDate: (units: OnlyDateUnits) => Date; toOnlyDateFormat: (units: OnlyDateUnits) => OnlyDateFormat; inRange: (units: OnlyDateUnits, start: Date, end: Date) => boolean; withBoundaries: (date: Date, min: Date, max: Date) => Date; getDaysInMonth: (year: number, month: number) => number; getSortedDateUnitPositions: (locale: string) => DateUnitType[]; getLocalizedMonthNames: (locale: string) => string[]; isFirstUnitPosition: (list: DateUnitType[], search: DateUnitType) => boolean; isLastUnitPosition: (list: DateUnitType[], search: DateUnitType) => boolean; }; //# sourceMappingURL=date.d.ts.map