nathanreyes / v-calendar

An elegant calendar and datepicker plugin for Vue.
https://vcalendar.io
MIT License
4.38k stars 856 forks source link

valid-hours prop not working #1414

Closed S3B-4 closed 10 months ago

S3B-4 commented 10 months ago

Hi All,

I'm using Vue3, and VCalander. Installed it like this npm install v-calendar@next @popperjs/core and have the following dependencies added tot the package json:

"@popperjs/core": "^2.11.8",
"v-calendar": "^3.1.2",

When i try to use the :valid-hours prop on the VDatePicker i can't get it to work. Not as an array, the min max object or a function as documented here ( https://v2.vcalendar.io/datepicker.html#date-time ). It just appears like the valid-hours is just not picked up by the VDatePicker component.

<script>
const testDate = ref(new Date());
</script>
<template>
    <VDatePicker
        mode="dateTime"
        v-model="testDate"
        :valid-hours="[1, 2, 3]"
        is24hr
    />
</template>

Is this a known bug or am i using it wrong?

Best regards, Seb

S3B-4 commented 10 months ago

was looking at the wrong version of the documentation. In v-calendar v3 use the rules prop instead: :rules="{ hours: [1, 2, 3] }"

https://vcalendar.io/datepicker/time-rules.html