Search code examples
vue.jsdatepickermomentjsvue-componentvuetify.js

How can I disable all sunday on datepicker?


I use vuetify datepicker and moment js

I want to disable sunday on datepicker

My code like this :

<v-date-picker
        v-model="date"
        :allowed-dates="allowedDates"
        class="mt-4"
        :min="currentDate"
        @update:picker-date="pickerUpdate($event)"
      ></v-date-picker>

My full code and codepen like this : https://codepen.io/positivethinking639/pen/qBBjaJr?editors=1010

How can I do it?

So I want to disable all Sundays in October, November and December


Solution

  • One obvious solution is to check the day of week before pushing the date to available dates:

    if (moment(date).day() !== 0)
      availableDates.push(date)
    

    https://codepen.io/leopsidom/pen/poowNjJ?editors=1011