This commit is contained in:
2019-03-08 18:57:00 +00:00
parent 2bb702dc88
commit 4c7eeb8e7b
3 changed files with 27 additions and 2 deletions

View File

@@ -18,6 +18,7 @@ TODO NEXT
DATETIME
- Does it validate properly? NO. Get validation working!!
- https://baianat.github.io/vee-validate/concepts/components.html#how-it-works
- possibly helpful https://stackoverflow.com/questions/47982820/vuejs-vee-validate-in-custom-components
- or https://duckduckgo.com/?q=vee+validate+with+custom+component&t=ffab&atb=v134-6__&ia=web

View File

@@ -11,6 +11,7 @@
v-model="formatDate"
v-bind:label="label"
readonly
:error="!(!error)"
></v-text-field>
</template>
<v-date-picker v-model="dateOnly" @input="dlgdate = false">
@@ -22,7 +23,15 @@
<v-flex xs6>
<v-dialog v-model="dlgtime" persistent lazy full-width width="290px">
<template v-slot:activator="{ on }">
<v-text-field v-on="on" v-model="formatTime" label prepend-icon="fa-clock" @click:prepend="dlgtime = true" readonly></v-text-field>
<v-text-field
v-on="on"
v-model="formatTime"
label
prepend-icon="fa-clock"
@click:prepend="dlgtime = true"
readonly
:error="!(!error)"
></v-text-field>
</template>
<v-time-picker v-model="timeOnly">
<v-spacer></v-spacer>
@@ -38,6 +47,7 @@
prepend-icon="fa-calendar-alt"
disabled
></v-text-field>
<p v-show="error" class="form__error v-messages theme--light error--text">{{ error }}</p>
</div>
</template>
<script>
@@ -52,11 +62,23 @@ export default {
throw "GzDateAndTimePicker: $gzlocale is required and missing";
}
},
$_veeValidate: {
name() {
return this.label;
},
value() {
return this.value;
}
},
data: () => ({ date: null, dlgdate: false, dlgtime: false }),
props: {
label: String,
value: String,
readonly: { type: Boolean, default: false }
readonly: { type: Boolean, default: false },
error: {
type: String,
required: false
}
},
watch: {
date() {

View File

@@ -57,6 +57,7 @@
:error-messages="errors.collect('startDate')"
v-validate="'before:endDate'"
ref="startDate"
:error="errors.first('startDate')"
></gz-date-time-picker>
</v-flex>
@@ -68,6 +69,7 @@
:error-messages="errors.collect('endDate')"
v-validate="'after:startDate'"
ref="endDate"
:error="errors.first('endDate')"
></gz-date-time-picker>
</v-flex>