export declare type FormatTokenType = 'M' | 'MM' | 'd' | 'dd' | 'YYYY' | 'h' | 'hh' | 'H' | 'HH' | 'mm' | 'aa'; export declare const FORMAT_TOKENS: FormatTokenType[]; export declare type DateType = 'date' | 'datetime' | 'time'; export declare type DateForm = 'short' | 'spoken'; export declare function isToken(maybeToken: string): maybeToken is FormatTokenType; export declare const TOKEN_FORMATTERS: { [token in FormatTokenType]: (date: Date) => string; }; export declare const TOKEN_SETTERS: { [token in FormatTokenType]: (date: Date, value: string) => void; }; export declare function parseFormat(formatStr: string): string[]; interface GetLocaleformatOpt { type: DateType; } /** Returns an array representing how to format a date based on current locale */ export declare function getLocaleFormat(locale?: string, options?: GetLocaleformatOpt): string; export declare function getDefaultFormat(type: DateType): string; export declare function formatDate(date: Date, format: string): string; export declare function getFormatter(type: DateType | Intl.DateTimeFormatOptions, locale?: string): (d: Date) => string; /** Returns a date in ISO `YYYY-MM-dd` format. */ export declare const toISODate: (date: Date) => string; /** Splits an ISO date and returns the year/month/day as an array of numbers. */ export declare const dateParts: (date: string) => [number, number, number]; /** * Sets the given value(s) on the Date; if the day overflows and * changes the month, it clamps to the last day of the given month. */ export declare const clampDate: (date: Date, method: 'day' | 'month' | 'year', value: number, maybeMonth?: number | undefined, maybeDay?: number | undefined) => Date; export declare function getLastDayOfMonth(month: number, year?: number): number; /** * Partial date is to allow the saving and formatting of an incomplete date. * Values which are not available will be replaced with # when formatting, * therefore, # should not be used in a format string. * * A core assumption of this class is that your initial format will be considered * in all getters and setters */ export declare class PartialDate implements FormatTokenMap { constructor(date?: string | Date, formatOrOpts?: string | Partial); private _input; private _locale; private _localeFormat; private _format; private _type; private year?; private month?; private day?; private hours?; private minutes?; private period?; private _year?; private _month?; private _day?; private _hours?; private _minutes?; get M(): string | undefined; set M(value: string | undefined); get MM(): string | undefined; set MM(value: string | undefined); get d(): string | undefined; set d(value: string | undefined); get dd(): string | undefined; set dd(value: string | undefined); get YYYY(): string | undefined; set YYYY(value: string | undefined); get h(): string | undefined; set h(value: string | undefined); get hh(): string | undefined; set hh(value: string | undefined); get H(): string | undefined; set H(value: string | undefined); get HH(): string | undefined; set HH(value: string | undefined); get mm(): string | undefined; set mm(value: string | undefined); get aa(): string | undefined; set aa(value: string | undefined); getYear(): number; setYear(value: number): void; getMonth(): number; setMonth(value: number): void; getDate(): number; setDate(value: number): void; getHours(): number; get_Hours(): string; setHours(value: number): void; getMinutes(): number; setMinutes(value: number): void; getLocaleFormat(): string; getFormat(): string; getLocale(): string; setLocale(locale: string): void; getType(): DateType; setType(type: DateType, format: string): void; private pad; private getValueAndDisplay; setAllFromDate(date: Date): void; parse(dateStr: string, format?: string): PartialDate; format(format?: string): string; parseTime(format?: string): this; equals(date?: PartialDate, type?: DateType): boolean; toLocaleFormat(): string; toLocaleSpoken(type: DateType): string; toDate(): Date; isValidDate(): boolean; isValidTime(): boolean; isValid(): boolean; isDayOfMonth(day: number): boolean; getLastDayOfMonth(): number; ensureDayOfMonth(): void; clone(): PartialDate; toValue(): Date | string | number; static from(date: null | string | Date | number | PartialDate, formatOrOpts?: string | Partial): PartialDate; } declare type FormatTokenMap = { [key in FormatTokenType]?: string | number; }; interface PartialDateOpts { format: string; locale: string; type: DateType; } export {};