I’m trying to initialize a date range picker with a default value of the current day. Not working.
$(this).mobiscroll().range({
headerText: 'Select two dates',
display:'bottom',
showSelector: false,
defaultValue: null,
dateFormat: js_dateformat,
defaultValue: ['2021-11-12','2021-11-12'],
returnFormat: 'iso8601',
buttons:['cancel','set'],
min: mindate,
max: maxdate,
responsive: {
small:{
display: 'center'
}
},
onSet: (ev, inst) => {
var values = inst.getVal();
var start = values[0];
var end = values[1];
$('#' + frominput).val(start);
$('#' + toinput).val(end);
}
});
Notice I’m setting the defaultvalue property like so
defaultValue: ['2021-11-12','2021-11-12']
According to the documentation (https://docs.mobiscroll.com/4-10-9/jquery/range#opt-defaultValue) this should work, but clearly I’m doing something wrong. Why is it not setting the default value for me?