Date and time filtering does not work.
Date and time filtering does not work.
Hello!
I use moment.min.js and datetime-moment.js.
The data comes in the form of:
"createdDate": "24.09.2021 17:17:31",
Initializing
$.fn.dataTable.moment('DD.MM.YYYY h:mm:ss a');
Only then I run the table.
The problem is that the filtering does not work correctly, for example, I want the most recent date to be the first, but it gets different.
Please tell me what am I doing wrong ?
!
!
This question has an accepted answers - jump to answer
Answers
Looks like your format
'DD.MM.YYYY h:mm:ss a'
is wrong. Refer to the moment.js docs for the formatting details. Looks like theh
should behh
and you don't have AM/PM so there shouldn't bea
. Tyr this format'DD.MM.YYYY hh:mm:ss'
.If you still need help please provide a running test case showing your data so we can help debug.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
Kevin
Sorry, I didn't answer right away. The instruction from above completely solved the problem.