Issue with DataTables DateTime() value
Issue with DataTables DateTime() value
![jadsy2107](https://secure.gravatar.com/avatar/70d1a797fd170b0214bac0b7cbdcab63/?default=https%3A%2F%2Fvanillicon.com%2F70d1a797fd170b0214bac0b7cbdcab63_200.png&rating=g&size=120)
I am having an issue with DataTable DateTime function maybe its a bug.
callsminDate = new DateTime($('#callsmin'), {
format: 'll',
buttons: {
clear: true
}
});
This is my initialization of DateTime on my input #callsmin
Then on change, I filter the table which is working well, just on the first selection it gives me the wrong value;
// Refilter the table
$('#callsmin, #callsmax').on('change', function () {
callstable.draw();
mincallsts = moment(callsminDate.val(), "M/D/YYYY").unix();
maxcallsts = moment(callsmaxDate.val(), "M/D/YYYY").unix();
console.log(mincallsts);
});
When I first select a Date it gives me hours and seconds too in my timestring, which is 1655493811
Then I choose another Date and back to this date, and it gives me the correct value which is 1655424000 (notice there is no hours and minutes)
It seems as though DateTime is initializing with the hours and minutes initially, then changes to not include the hours and minutes which is what i want.
Answers
I have even found this bug in the DataTables example:
https://datatables.net/extensions/datetime/examples/integration/datatables.html
If you select the date November 28th 2008
You wont see the row that was dated November 28th 2008
but if you select it again, it appears
This is because on first select, it includes hours, minutes and seconds, So November 28th 2008 1:07PM , instead of just the date.
On second select, its correct it filters just the date