One of the most common ways to represent date range selection is through a calendar with or without a time picker. Learn how to build a date-only picker.
mobiscroll.datepicker('#picker', {
controls: ['calendar', 'time'],
select: 'range',
display: 'inline',
touchUi:
});
Instead of selecting time from a list of values you can show a grid by passing 'timegrid' to the controls option.
mobiscroll.datepicker('#picker', {
controls: ['calendar', 'timegrid'],
select: 'range',
display: 'inline',
touchUi:
});
Passing datetime to the controls option renders a compact date scroller and a time scroller or dropdown with customizable start and end labels.
{
controls: ['datetime'],
select: 'range',
display: 'inline',
touchUi:
}
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.
mobiscroll.datepicker('#picker', {
controls: ['datetime'],
select: 'range',
touchUi:
});
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.
html<div id="range"></div>
<label>
Start
<input id="start" mbsc-input placeholder="Please select..." />
</label>
<label>
End
<input id="end" mbsc-input placeholder="Please select..." />
</label>
js$('#range').mobiscroll().datepicker({
controls: ['datetime'],
select: 'range',
startInput: '#start',
endInput: '#end',
touchUi:
});