Time Range Picker
Set up the range picker for time pair selection. Regardless if you are interested in the start/end date or the actual range, you have several possibilities of rendering a time range picker. The controls option supports different values:
time- will render a time picker or dropdown for range selectiontimegrid- will render a time grid for range selectioncalendar- will render a calendar view for date range selection (explore date ranges)date- will render a date scroller or dropdown for date range selection (explore date ranges)datetime- will render a compact date scroller or dropdown with time picker for date & time range selection (explore date & time ranges)
Demo
Use the time range inline by setting the display option to inline. Learn about the different ways to use the picker.
<template>
<MbscDatepicker
select="range"
display="inline"
:controls="['time']"
:touchUi=" "
/>
</template>
For a time grid rendering pass 'timegrid' to the controls option.
<template>
<MbscDatepicker
select="range"
display="inline"
:controls="['timegrid']"
:touchUi=" "
/>
</template>
Besides rendering it inline, you can link the range to an input that can be a Mobiscroll input or an existing field. Explore the different ways to display the picker.
<template>
<MbscDatepicker
select="range"
:controls="['time']"
:touchUi=" "
/>
</template>
When using two separate inputs for start and end, you will want to initialize the component on the first input and make sure to pass the references of the two inputs through the startInput and endInput options.
<script setup>
const startInput = ref(null)
const endInput = ref(null)
</script>
<template>
<MbscDatepicker
select="range"
:controls="['time']"
:startInput="startInput"
:endInput="endInput"
:touchUi=" "
/>
<MbscInput ref="startInput" label="Start"/>
<MbscInput ref="endInput" label="End"/>
</template>
<script setup>
import { MbscDatepicker, MbscInput, MbscPage, setOptions } from '@mobiscroll/vue'
import { ref } from 'vue'
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
})
const startInput = ref(null)
const endInput = ref(null)
</script>
<template>
<MbscPage>
<MbscDatepicker :controls="['time']" select="range" display="inline" />
<MbscDatepicker :controls="['timegrid']" select="range" display="inline" />
<MbscDatepicker
:controls="['time']"
select="range"
label="Range"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
<MbscDatepicker
:controls="['time']"
:startInput="startInput"
:endInput="endInput"
select="range"
/>
<div class="mbsc-grid mbsc-no-padding">
<div class="mbsc-row">
<div class="mbsc-col-6">
<MbscInput
ref="startInput"
label="Start"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
</div>
<div class="mbsc-col-6">
<MbscInput
ref="endInput"
label="End"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
</div>
</div>
</div>
</MbscPage>
</template>
<script setup lang="ts">
import { MbscDatepicker, MbscInput, MbscPage, setOptions } from '@mobiscroll/vue'
import { ref } from 'vue'
setOptions({
locale: ,
theme: ' ',
themeVariant: ' '
})
const startInput = ref<any>(null)
const endInput = ref<any>(null)
</script>
<template>
<MbscPage>
<MbscDatepicker :controls="['time']" select="range" display="inline" />
<MbscDatepicker :controls="['timegrid']" select="range" display="inline" />
<MbscDatepicker
:controls="['time']"
select="range"
label="Range"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
<MbscDatepicker
:controls="['time']"
:startInput="startInput"
:endInput="endInput"
select="range"
/>
<div class="mbsc-grid mbsc-no-padding">
<div class="mbsc-row">
<div class="mbsc-col-6">
<MbscInput
ref="startInput"
label="Start"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
</div>
<div class="mbsc-col-6">
<MbscInput
ref="endInput"
label="End"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
</div>
</div>
</div>
</MbscPage>
</template>