[Vuejs]-How can I disable all sunday on datepicker?

3👍

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

👤Psidom

1👍

I would just do simple check which day it is with either dayjs or moment

allowedDates(val) {
  return dayjs(val).day() !== 0;
},
👤Semko

0👍

Vue Datepicker have a build in filter to filter out or disable specific week day

0 bein Sunday
6 being Saturday

  <template>
    <VueDatePicker v-model="date" :disabled-week-days="[6, 0]" />
  </template>
👤Korak

Leave a comment