Skip to content
Advertisement

How to disable the hours before the start date&time using v-calendar?

I am using v-calendar to have the start date&time and end date&time using mode as dateTime. My requirement is to make the end date&time not go before the start date&time. For this, I am using :min-date prop bounded with start date&time value as shown in the below code.

JavaScript

Now let’s say the start date&time selected is Feb 10th, 05:00 AM and while selecting the end date&time, the dates before the 10th will be disabled. But If I select 10th as the date(same date), I could still select 04:00 AM as the time, which is not proper.

So is there a way of disabling the time with respect to the selected date?

Advertisement

Answer

As I can see in their documentation you can pass validHours prop that is a function that returns if an hour is valid.

So depending on your implementaton you can do something like this:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement