Time picker configuration
Props to configure time picker, whether using it only as time picker or alongside the datepicker
Info
- When checking the examples, for
boolean
prop types, the example will show the behavior opposite of what is set for the default value - If you use the component in the browser
<script>
tag, make sure to pass multi-word props with-
, for example,enableTimePicker
asenable-time-picker
and so on
time-picker-inline
Set the time picker under the calendar instead of opening the overlay
- Type:
boolean
- Default:
false
Code Example
<template>
<VueDatePicker v-model="date" time-picker-inline />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
enable-time-picker
Enable or disable time picker
- Type:
boolean
- Default:
true
Code Example
<template>
<VueDatePicker v-model="date" :enable-time-picker="false" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
is-24
Whether to use 24H or 12H mode
- Type:
boolean
- Default:
true
Code Example
<template>
<VueDatePicker v-model="date" :is-24="false" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
enable-seconds
Enable seconds in the time picker
- Type:
boolean
- Default:
false
Code Example
<template>
<VueDatePicker v-model="date" enable-seconds />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
hours-increment
The value which is used to increment hours via arrows in the time picker
- Type:
number | string
- Default:
1
Code Example
<template>
<VueDatePicker v-model="date" hours-increment="2" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
minutes-increment
The value which is used to increment minutes via arrows in the time picker
- Type:
number | string
- Default:
1
Code Example
<template>
<VueDatePicker v-model="date" minutes-increment="5" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
seconds-increment
The value which is used to increment seconds via arrows in the time picker
- Type:
number | string
- Default:
1
Code Example
<template>
<VueDatePicker v-model="date" enable-seconds seconds-increment="5" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
hours-grid-increment
The value which is used to increment hours when showing hours overlay
It will always start from 0 until it reaches 24 or 12 depending on the is-24
prop
- Type:
number | string
- Default:
1
Code Example
<template>
<VueDatePicker v-model="date" hours-grid-increment="2" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
minutes-grid-increment
The value which is used to increment minutes when showing minutes overlay
It will always start from 0 to 60 minutes
- Type:
number | string
- Default:
5
Code Example
<template>
<VueDatePicker v-model="date" minutes-grid-increment="2" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
seconds-grid-increment
The value which is used to increment seconds when showing seconds overlay
- Type:
number | string
- Default:
5
Code Example
<template>
<VueDatePicker v-model="date" enable-seconds seconds-grid-increment="2" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
no-hours-overlay
Disable overlay for the hours, only arrow selection will be available
- Type:
boolean
- Default:
false
Code Example
<template>
<VueDatePicker v-model="date" no-hours-overlay />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
no-minutes-overlay
Disable overlay for the minutes, only arrow selection will be available
- Type:
boolean
- Default:
false
Code Example
<template>
<VueDatePicker v-model="date" no-minutes-overlay />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
no-seconds-overlay
Disable overlay for the seconds, only arrow selection will be available
- Type:
boolean
- Default:
false
Code Example
<template>
<VueDatePicker v-model="date" no-seconds-overlay enable-seconds />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
min-time
Sets the minimal available time to pick
- Type:
{ hours?: number | string; minutes?: number | string; seconds?: number | string }
- Default:
null
Code Example
<template>
<VueDatePicker v-model="date" :min-time="{ hours: 11, minutes: 30 }" placeholder="Select Date" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
max-time
Sets the maximal available time to pick
- Type:
{ hours?: number | string; minutes?: number | string; seconds?: number | string }
- Default:
null
Code Example
<template>
<VueDatePicker v-model="date" :max-time="{ hours: 11, minutes: 30 }" placeholder="Select Date" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
</script>
start-time
Set some default starting time
- Type:
- Single picker:
{ hours?: number | string; minutes?: number | string; seconds?: number | string }
- Range picker:
{ hours?: number | string; minutes?: number | string; seconds?: number | string }[]
- Single picker:
- Default:
null
Code Example
<template>
<VueDatePicker v-model="date" :start-time="startTime" placeholder="Select Date" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref();
const startTime = ref({ hours: 0, minutes: 0 });
</script>
disable-time-range-validation
Explicitly allow end time in range mode to be before the start time
- Type:
boolean
- Default:
false
Code Example
<template>
<VueDatePicker v-model="time" time-picker disable-time-range-validation range placeholder="Select Time" />
</template>
<script setup>
import { ref } from 'vue';
const time = ref();
</script>
disabled-times
Provide a function that will return true
or false
depending on a given time value
- Type:
(time: TimeObj | TimeObj[] | (TimeObj | undefined)[]) => boolean;
- Default:
undefined
type TimeObj = { hours: number; minutes: number; seconds: number };
Code Example
<template>
<VueDatePicker v-model="date" :disabled-times="isTimeDisabled" />
</template>
<script setup>
import { ref } from 'vue';
const date = ref(new Date());
const isTimeDisabled = (value) => {
// disable selection on all dates that have minutes set to 15
return value.minutes === 15;
};
</script>