vuetify-datetime-picker
vuetify-datetime-picker copied to clipboard
Validation
Having trouble finding a way to validate this component. If I try to use the "rules" prop on either the datePickerProps or timePickerProps it breaks the code. Is there an existing prop for this component for passing in validation rules or is this something that has yet to be handled?
If it can help you, i did the following on my project:
<ValidationProvider v-slot="{ errors }" name="Datetime" rules="required">
<v-datetime-picker
:error-messages="errors"
:text-field-props="{dense: true, prependIcon: 'event'}"
:date-picker-props="dateProps"
:time-picker-props="timeProps"
label="Date & Time"
v-model="selectedEventLocal.datetime">
</v-datetime-picker>
</ValidationProvider>
But to do this (:error-messages) i had to fork the repo and do this: code
Hope it helps.
Thanks, bro @devstack-be, it did help me
For others who is looking for validation you can just add :textFieldProps="{ rules: [v => !!v || "You have to select a date!"] }" as an example,
The option above with a simple rule is working fine. In Vuetify components it's possible to use a method to validate more complex rules. Is it possible to use a rule with this component ? If not, how to validate complex validation rules ?