Date Range Picker
Set up the range picker for date pair selection. Regardless if you are interested in the start/end date or the actual range, you have several possibilities of rendering a date range picker. The controls option supports different values:
calendar- will render a calendar view for date range selectiondate- will render a date scroller or dropdown for date range selectiondatetime- will render a compact date scroller or dropdown with time picker for date & time range selection (explore date & time ranges)time- will render a time picker for range selection (explore time ranges)timegrid- will render a time grid for range selection (explore time ranges)
Demo
One of the most common ways to represent date range selection is through a calendar view with one or more months. Learn about how to configure and customize the calendar.
<template>
<MbscDatepicker
select="range"
display="inline"
calendarType="month"
:controls="['calendar']"
:pages="2"
:touchUi=" "
/>
</template>
Passing date to the controls option renders a date scroller or dropdown with customizable start and end labels.
<template>
<MbscDatepicker
select="range"
display="inline"
:controls="['date']"
:touchUi=" "
/>
</template>
By setting the select: 'preset-range' you can pre-set the parameters of the selection rather than let people freely pick start/end dates. The first day and length can be set through the firstSelectDay and selectSize options.
<template>
<MbscDatepicker
select="preset-range"
display="inline"
:controls="['calendar']"
:firstSelectDay="2"
:selectSize="10"
: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 more ways to use the picker.
<template>
<MbscDatepicker
select="range"
calendarType="month"
:controls="['calendar']"
:pages="2"
: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"
calendarType="month"
:controls="['calendar']"
:startInput="startInput"
:endInput="endInput"
:pages="2"
: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="['calendar']"
:pages="2"
select="range"
display="inline"
calendarType="month"
/>
<MbscDatepicker :controls="['date']" select="range" display="inline" />
<MbscDatepicker
:controls="['calendar']"
select="range"
label="Range"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
<MbscDatepicker
:controls="['calendar']"
: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="['calendar']"
:pages="2"
select="range"
display="inline"
calendarType="month"
/>
<MbscDatepicker :controls="['date']" select="range" display="inline" />
<MbscDatepicker
:controls="['calendar']"
select="range"
label="Range"
inputStyle="outline"
labelStyle="stacked"
placeholder="Please Select..."
/>
<MbscDatepicker
:controls="['calendar']"
: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>