vuetify date picker range limit to amount of days

Viewed 686

I would like to know is there a way, how can I limit selection of days to some external props number. What I'd like to achive here for example is if I pass 10 days then in range I can select no more then 10 daysenter image description here

   <v-date-picker
      v-model="date"
      :color="color"
      :range="true"
      :allowed-dates="allowedDates"
    >
      <v-btn text color="primary" @click="menu = false">Cancel</v-btn>
      <v-btn text color="primary" @click="onSubmitDate">OK</v-btn>
    </v-date-picker>
  </v-menu>

...
  data() {
    return {
      date: '',
      menu: false,
    };
  },
methods:{
    allowedDates(date) {
      // Can not select days before today and today
      return new Date(date).valueOf() <= Date.now();
    }
}
0 Answers
Related