hello everyone i’m having problem in daterange filter datatables, like i choose date range from february 24 – february 25. why the data that appears only on the 25th of February and the 24th does not appear?
this my view HTML
<label form="min_date">Start Date</label>
<div class="input-group date">
<div class="form-line" >
<input type="text" class="form-control" id="min_d" name="min_d" >
</div>
</div>
<label form="max_date">End Date</label>
<div class="input-group date">
<div class="form-line" >
<input type="text" class="form-control" id="max_d" name="max_d" >
</div>
</div>
this my Javascript
$.fn.dataTable.ext.search.push(
function( settings, data, dataIndex ) {
var min = minDate.val();
var max = maxDate.val();
var date = new Date( data[4] );
if (
( min === null && max === null ) ||
( min === null && date <= max ) ||
( min <= date && max === null ) ||
( date >= min && date <= max )
) {
return true;
}
return false;
}
);
$(document).ready(function() {
minDate = new DateTime($('#min_d'), {
format: 'D-MM-YYYY'
});
maxDate = new DateTime($('#max_d'), {
format: 'D-MM-YYYY'
});strong text
var table = $('#transactions').DataTable();
$('#min_d, #max_d').on('change', function () {
table.draw();
});
});