Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DisabledDates function is not called at first rendering in MonthPicker #1070

Open
ashab20zakaraev opened this issue Jan 13, 2025 · 0 comments
Labels
awaiting triage The issue is not reviewed by the maintainers bug Something isn't working

Comments

@ashab20zakaraev
Copy link

ashab20zakaraev commented Jan 13, 2025

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.
image

@ashab20zakaraev ashab20zakaraev added awaiting triage The issue is not reviewed by the maintainers bug Something isn't working labels Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting triage The issue is not reviewed by the maintainers bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant