Closed
Description
Describe the bug
Props disabledDates using the function does not work as expected.
To Reproduce
Simple code to reproduce the problem:
<template>
<div class="wrapper">
<Datepicker
v-model="selectedDate"
month-picker
:disabled-dates="isDisabledMonth"
placeholder="Select Date" />
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import Datepicker from '../src/VueDatePicker/VueDatePicker.vue';
const selectedDate = ref();
const allowedMoths = [
"2024-04-30",
"2024-05-31"
]
function isDisabledMonth(date) {
const month = new Date(date).toISOString().split("T")[0];
console.log(date)
return !allowedMoths.includes(month)
}
</script>
<style lang="scss">
.wrapper {
padding: 200px;
}
</style>
By running this code, you can verify that log is not called in the isDisabledMonth method.
Expected behavior
The function to be called on the first rendering and subsequent year changes in the calendar returning each date
Screenshots
I think the problem may be in the isMonthDisabled method in the date-utils file, as it doesn't handle the case if disabledDate function and accordingly it is not called.