0👍
You can do that of multiple way, but to stay on yours.
<template>
<DatePicker v-model="form.DOB" is-expanded update-on-input />
<v-col v-if="userIsMajor">
<v-text-field placeholder="ID" v-model="form.ID"></v-text-field>
</v-col>
</template>
<script>
export default {
data() {
return {
form: {
DOB: '',
},
}
},
computed: {
userIsMajor() {
// moment() = the current date
// diff calculate the difference between two date, the first argument is your date and the second the format you want
// You don't really respond about the format, so i done it with a common format wich is YYYY-MM-DD
return moment().diff(moment(this.form.DOB, 'YYYY-MM-DD'), 'years')
},
},
}
</script>
Source:stackexchange.com