export declare const DAYS_PER_ROW: number; export declare const MONTHS_PER_ROW: number; export declare const YEARS_PER_ROW: number; export declare const YEARS_PER_PAGE: number; export declare const FORMAT_DATE: RegExp; /** * Abstract date functionality. * * Adapted from https://github.com/angular/components/blob/main/src/material/core/datetime/date-adapter.ts */ export declare abstract class DateAdapter { /** * Get the year as a number. * @param date */ abstract getYear(date: T): number; /** * Get the month as a number. * Attention: This returns 1-12 and mitigates the default JavaScript Date behavior. * @param date */ abstract getMonth(date: T): number; /** * Get the day of the month as a number. * @param date */ abstract getDate(date: T): number; /** * Get the Day of the week as a number. * @param date */ abstract getDayOfWeek(date: T): number; abstract getFirstDayOfWeek(): number; /** * Get the number of days in a month. * @param year * @param month * */ abstract getNumDaysInMonth(date: T): number; /** * Get a list of all the months in a given style. * @param style */ abstract getMonthNames(style: 'long' | 'short' | 'narrow'): string[]; /** Get a string array with length = 31, filled with the days in a month, starting from 1. */ abstract getDateNames(): string[]; /** * Get a list of all the week days in a given style. * @param style */ abstract getDayOfWeekNames(style: 'long' | 'short' | 'narrow'): string[]; /** Creates today's date. */ abstract today(): T; /** * Checks whether a given `date` is valid. * @param date * */ abstract isValid(date: T | null | undefined): boolean; /** Creates a new date by cloning the given one. * @param date * */ abstract clone(date: T): T; /** * Creates a new date, given day, month and year; without date's overflow. * @param year * @param month The month of the date (1-indexed, 1 = January). Must be an integer 1 - 12. * @param date * */ abstract createDate(year: number, month: number, date: number): T; /** * Attempts to deserialize a value to a valid date object. This is different from parsing in that * deserialize should only accept non-ambiguous, locale-independent formats (e.g. a ISO 8601 * string). The default implementation does not allow any deserialization, it simply checks that * the given value is already a valid date object or null. * @param date Either Date, ISOString, Unix Timestamp (number of seconds since Jan 1, 1970). * @returns The date if the input is valid, `null` otherwise. * */ deserialize(value: T | string | number | null | undefined): T | null; /** * Creates a new date adding the number of provided `years` to the provided `date`. * @param date The starting date. * @param years The number of years to add. */ abstract addCalendarYears(date: T, years: number): T; /** * Creates a new date adding the number of provided `months` to the provided `date`. * If the calculated month has fewer days than the original one, the date is set to the last day of the month. * E.g. with `date` = new Date(2022, 0, 31) and `months` = 1, it returns new Date(2022, 1, 28). * @param date The starting date. * @param months The number of months to add. */ abstract addCalendarMonths(date: T, months: number): T; /** Creates a new date by adding the number of provided `days` to the provided `date`. * @param date The starting date. * @param days The number of days to add. */ abstract addCalendarDays(date: T, days: number): T; /** Get the date in the local format. * @param date The date to format * @returns The `date` in the local format as string. */ abstract getAccessibilityFormatDate(date: T | string): string; /** Get the given string as Date. * @param value The date in the format DD.MM.YYYY. * @param now The current date as Date. */ abstract parse(value: string | null | undefined, now: Date): T | undefined; /** Format the given Date as string. * @param value The date to format. */ abstract format(date: T | null | undefined): string; /** Checks whether the given `obj` is a Date. * @param obj The object to check. */ abstract isDateInstance(obj: any): boolean; /** * Gets date instance that is not valid. * @returns An invalid date. */ abstract invalid(): T; /** Get the given date as ISO String. * @param date The date to convert to ISO String. */ toIso8601(date: T): string; /** * Given a potential date object, returns that same date object if it is * a valid date, or `null` if it's not a valid date. * @param value The object to check. * @returns A date or `null`. */ getValidDateOrNull(value: unknown): T | null; /** * Calculates the day of the week of the first day of the month, and then its offset from the first day of the week. */ getFirstWeekOffset(date: T): number; /** * Compares two dates. * @param first The first date to compare. * @param second The second date to compare. * @returns 0 if the dates are equal, a number less than 0 if the first date is earlier, * a number greater than 0 if the first date is later. */ compareDate(first: T, second: T): number; /** * Checks if two dates are equal. * @param first The first date to check. * @param second The second date to check. * @returns Whether the two dates are equal. * Null dates are considered equal to other null dates. */ sameDate(first: T | null, second: T | null): boolean; /** * Clamp the given date between min and max dates. * @param date The date to clamp. * @param min The minimum value to allow. If null or omitted no min is enforced. * @param max The maximum value to allow. If null or omitted no max is enforced. * @returns `min` if `date` is less than `min`, `max` if date is greater than `max`, * otherwise `date`. */ clampDate(date: T, min?: T | null, max?: T | null): T; } //# sourceMappingURL=date-adapter.d.ts.map