icehaunter / vue3-datepicker

Simple datepicker component for Vue 3
https://icehaunter.github.io/vue3-datepicker/
MIT License
150 stars 153 forks source link

Support disabling dates by day of week #66

Closed steven-mankins closed 1 year ago

steven-mankins commented 2 years ago

It appears disabled dates only accept specific days. Is there a way to say disable every weekend, am I missing it? If not would be a good feature

icehaunter commented 1 year ago

You can implement this via a predicate:

  <script setup>
  import Datepicker from 'vue3-datepicker'
  import { ref } from 'vue'
  import { isWeekend } from 'date-fns'
  const pickedDate = ref(new Date())
  </script>

  <template>
    <Datepicker
      v-model="pickedDate"
      :disabledDates="{ predicate: isWeekend }"
    />
  </template>

Or function of any complexity