[Vuejs]-Can today's date be disabled in <v-date-picker>?

0👍

Just use :min="tomorrow"?

data() {
    const today = new Date()
    return { tomorrow: new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1)
  }
}

Or use the :allowed-date prop to allow everything except for today:

<v-date-picker :allowed-dates="allowedDates" />

methods: {
  allowedDates(date) {
    return !isToday(date)
  }
}

0👍

<template>
  <v-date-picker v-model="dateTo" :max="maxDateAllowed"></v-date-picker>
</template>


computed: {
  maxDateAllowed() {
    const d = new Date()
    const endDate = new Date(d.getFullYear(), d.getMonth(), d.getDate() - 1);

    return endDate.toISOString().slice(0,10)
  }
}

Leave a comment