| 18 | import { IDatePickerBaseProps } from "./datePickerCore"; |
| 19 | |
| 20 | export interface IDateFormatProps { |
| 21 | /** |
| 22 | * The error message to display when the date selected is invalid. |
| 23 | * @default "Invalid date" |
| 24 | */ |
| 25 | invalidDateMessage?: string; |
| 26 | |
| 27 | /** |
| 28 | * The locale name, which is passed to `formatDate`, `parseDate`, and the functions in `localeUtils`. |
| 29 | */ |
| 30 | locale?: string; |
| 31 | |
| 32 | /** |
| 33 | * The error message to display when the date selected is out of range. |
| 34 | * @default "Out of range" |
| 35 | */ |
| 36 | outOfRangeMessage?: string; |
| 37 | |
| 38 | /** |
| 39 | * Placeholder text to display in empty input fields. |
| 40 | * Recommended practice is to indicate the expected date format. |
| 41 | */ |
| 42 | placeholder?: string; |
| 43 | |
| 44 | /** |
| 45 | * Function to render a JavaScript `Date` to a string. |
| 46 | * Optional `locale` argument comes directly from the prop on this component: |
| 47 | * if the prop is defined, then the argument will be too. |
| 48 | */ |
| 49 | formatDate(date: Date, locale?: string): string; |
| 50 | |
| 51 | /** |
| 52 | * Function to deserialize user input text to a JavaScript `Date` object. |
| 53 | * Return `false` if the string is an invalid date. |
| 54 | * Return `null` to represent the absence of a date. |
| 55 | * Optional `locale` argument comes directly from the prop on this component. |
| 56 | */ |
| 57 | parseDate(str: string, locale?: string): Date | false | null; |
| 58 | } |
| 59 | |
| 60 | export function getFormattedDateString( |
| 61 | date: Date | false | null, |
no outgoing calls
no test coverage detected