UNPKG

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