Good times
I need to know how to do so that when the user selects the date of entry, do not open the 2nd date.
HTML
<div id="fecha" class="col-xs-12 col-md-6 right block-right">
<div class="col-md-7 col-xs-10">
<div class="input-group input-daterange" data-date-format="dd/mm/yyyy">
<input id="min" type="text" class="input-sm form-control text-center" name="min" placeholder="Desde"/>
<span class="input-group-addon">></span>
<input id="max" type="text" class="input-sm form-control text-center" name="max" placeholder="Hasta"/>
</div>
</div>
</div>
$.fn.dataTable.ext.search.push(
function (settings, data, iDataIndex ) {
let min = $('#min').datepicker("getDate");
let max = $('#max').datepicker("getDate");
{# console.log(min, max)#}
let from = data[8].split("/");
let startDate = new Date(from[2], from[1] - 1, from[0]);
{# console.log(from);#}
{# console.log(startDate);#}
if (min == null && max == null) { return true; }
if (min == null && startDate <= max) { return true;}
if(max == null && startDate >= min) {return true;}
if (startDate <= max && startDate >= min) { return true; }
return false;
}
);
$("#min").datepicker({
onSelect: function () {
table3.draw();
},
changeMonth: true,
changeYear: true,
dateFormat:"dd/mm/yy"
});
// Fecha Hasta
$("#max").datepicker({
onSelect: function () {
table3.draw();
},
changeMonth: true,
changeYear: true,
dateFormat:"dd/mm/yy"
});