UNPKG

1.59 kBTypeScriptView Raw
1import type { DatePickerBaseProps } from "./datePickerBaseProps";
2export interface DateFormatProps {
3 /**
4 * The error message to display when the date selected is invalid.
5 *
6 * @default "Invalid date"
7 */
8 invalidDateMessage?: string;
9 /**
10 * The locale name, which is passed to `formatDate`, `parseDate`, and the functions in `localeUtils`.
11 */
12 locale?: string;
13 /**
14 * The error message to display when the date selected is out of range.
15 *
16 * @default "Out of range"
17 */
18 outOfRangeMessage?: string;
19 /**
20 * Placeholder text to display in empty input fields.
21 * Recommended practice is to indicate the expected date format.
22 */
23 placeholder?: string;
24 /**
25 * Function to render a JavaScript `Date` to a string.
26 * Optional `localeCode` argument comes directly from the prop on this component:
27 * if the prop is defined, then the argument will be too.
28 */
29 formatDate(date: Date, localeCode?: string): string;
30 /**
31 * Function to deserialize user input text to a JavaScript `Date` object.
32 * Return `false` if the string is an invalid date.
33 * Return `null` to represent the absence of a date.
34 * Optional `localeCode` argument comes directly from the prop on this component.
35 */
36 parseDate(str: string, localeCode?: string): Date | false | null;
37}
38export declare function getFormattedDateString(date: Date | false | null | undefined, props: Omit<DateFormatProps, "parseDate"> & Pick<DatePickerBaseProps, "maxDate" | "minDate">, ignoreRange?: boolean): string;