import { Story, Meta, html } from '@open-wc/demoing-storybook'; import { loadDefaultFeedbackMessages, MinDate, MinMaxDate, MaxDate } from '@lion/validate'; import { formatDate } from '@lion/localize'; import '../lion-input-date.js'; # Input Date `lion-input-date` component is based on the generic text input field. Its purpose is to provide a way for users to fill in a date. {() => { loadDefaultFeedbackMessages(); return html` `; }} ```html ``` ## Features - Based on [lion-input](?path=/docs/forms-input--default-story) - Makes use of [formatDate](?path=/docs/localize-dates--formatting)) for formatting and parsing. - Option to override locale to change the formatting and parsing - Default label in different languages - Can make use of date specific [validators](?path=/docs/forms-validation-overview--page) with corresponding error messages in different languages - IsDate (default) - MinDate - MaxDate - MinMaxDate ## How to use ### Installation ```sh npm i --save @lion/input-date ``` ```js import '@lion/input-date/lion-input-date.js'; ``` ## Examples ### Validation {html`
Enter a date between ${formatDate(new Date('2018/05/24'))} and ${formatDate(new Date('2018/06/24'))}.
`}
```js import { loadDefaultFeedbackMessages, MinDate, MinMaxDate, MaxDate } from '@lion/validate'; import { formatDate } from '@lion/localize'; ``` IsDate ```html ``` MinDate ```html ``` MaxDate ```html ``` MinMaxDate ```html
Enter a date between ${formatDate(new Date('2018/05/24'))} and ${formatDate(new Date('2018/06/24'))}.
``` ### Faulty prefilled {html` `} ```html ```