Vue2-datepicker: Option to disable all weekends?

Created on 27 Jul 2018  路  6Comments  路  Source: mengxiong10/vue2-datepicker

Is there an option to disable all weekends on the calendar?

Most helpful comment

<date-picker v-model="value" lang="en" :disabled-days="disableWeekends"></date-picker>
methods: {
    disableWeekends (date) {
      const day = new Date(date).getDay()
      return day === 0 || day === 6
    }
}

All 6 comments

<date-picker v-model="value" lang="en" :disabled-days="disableWeekends"></date-picker>
methods: {
    disableWeekends (date) {
      const day = new Date(date).getDay()
      return day === 0 || day === 6
    }
}

"Invalid prop: type check failed for prop 'disabledDays'. Expected Array, got Function." I accepts both array and function, right?

upgrade to v2.x

Hey, I upgraded to v2.1.0. I'm not getting the "invalid prop" error for "disabledDays" anymore, but the disabling is still not happening. In fact, now my "not-before" and "not-after" are also not getting disabled.
If I switch back to 1.9.8, it works fine. But I need the "disabledDays" function for which like you mentioned, I'll have to use v2.x
Could you please help.
Thanks!

Not "disabled-days". Correctly is "disabled-date"

Was this page helpful?
0 / 5 - 0 ratings