Datepickers use a dialog window and provide a simple way to select a single value from a pre-determined set. The component can have disabled dates and it's really easy to use.
Vue Material datepicker supports multiple types of v-model
, whiches default is Date
. If you want to communicate with other services without timezone problems, you could use String
to avoid them:
:md-model-type
By default Datepicker component open on focus to it's input. This will make the input useless and the user will not be able to type the date manually. You can disable this behavior:
The Datepicker dialog can be made to close instantly after a date is selected. The date will be selected immediately without any additional confirmation or user action:
Sometimes you may need to disable certain dates from being selected. Let's suppose that you want to let the user select only week days:
All the following options can be applied to the md-datepicker component:
Name | Description | Default |
---|---|---|
v-model Date|Number|String | The model variable to bind the selected date | null |
md-model-type Constructor | Model type. This props will be overwritten by typeof v-model . It could be Date , Number or String . | Date |
md-disabled-dates Array|Function | The optional disabled dates. Can be either Array or Function. - If Array , the Datepicker will disable all days inside. - If Function , the Datepicker will pass the current day as a parameter of this function. If the return false, then the date will be disabled. | null |
md-open-on-focus Boolean | Disable the on focus event. Will open only if the user clicks on the icon. | true |
md-immediately Boolean | Select the date without confirm and close the dialog immediately. | false |
md-override-native Boolean | Override native browser pickers by changing type of input to text. | true |
md-debounce Number | Debounces the conversion of plaintext into a date object. Set to a longer time if your users type slowly, or shorter if your users type really fast. | 1000 |