Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
Limit time in v-calendar datepicker

I am working on a project where user request for appointment. I am using v-calendar which uses the datepicker.

I am facing a issue where user can request for appointment any time/ 24 hours which I need to set only for 9am - 5pm. I can see that we can limit date in date picker by using something like :max-date="value" but could not found how to limit the time.

Here is the working fiddle

some code from the project

    name="appointment-date"
    v-model="appointment_date"
    mode="dateTime"
    :is24hr="false"
    :min-date="currentDate"
    :model-config="dateTimePickerConfig"
    :popover="{
    visibility: 'click',
    placement:  'auto',
 }"
    :masks="{ inputDateTime: 'MM/DD/YYYY h:mmA'}">
    <template v-slot="{ inputValue, inputEvents }">
        <div class="form-icon ">
            <input-component
                :value="inputValue"
                v-on="inputEvents"
                placeholder="MM-DD-YYYY h:mmA"
            />
            <Icon name="date-time"/>
        </div>
    </template>
</date-picker>

Your help to solve the problem will be higly appreciated.

Thank you.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If I understood you well, you want to restrict picking specific hours. This is possible with v-calendar with the following property:

<v-date-picker v-model="date" :valid-hours="[0,3,4,5,8,16,20]" is24hr />

Please note the :valid-hours attribute. You can provide which hours should be available for the user to pick. If you want to allow them to pick minutes in specific 'intervals' you can use following as well:

<v-date-picker v-model="date" mode="dateTime" :minute-increment="15" />

Note :minute-increment property. This will allow user to pick between '15 minutes. So available numbers will be 00, 15, 30, 45. You can play with it.

Unfortunately, there is no way to disable minutes, which makes me sad. As if someone books appointment at 9:15 AM you would rather want to 'disable' 9:15 AM for next users. You could disable whole hour (9 AM) but not specifically 9:15, so that 9:00, 9:30 and 9:45 would still be available. At least I don't know any easy way.

Hope this helps anyone.

================ UPDATE =================
Note that v-calendar added those additional properties in specific v-calendar version. I've been using it with v2.4., seems like v2.3. does not have it yet.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!