$.fn.dataTableExt.afnFiltering.push not work with dd-mm-yyyy
$.fn.dataTableExt.afnFiltering.push not work with dd-mm-yyyy
i try to use $.fn.dataTableExt.afnFiltering.push for daterangefilter it's work fine with day to day but when pick month like
12/7/2019 - 1/8/2019 not work with month
12/7/2017 - 1/8/2019 not work with year
12/7/2019 - 31/7/2019 work fine only with day
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @theppiwat ,
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
http://live.datatables.net/burokodi/2/edit here is my test case.so sorry this's first time
Hi @theppiwat ,
There's several errors in that script, giving errors in the console.
minandmaxbefore checking if they're empty strings, so you need to move that empty test higher up in the function.createdAt[4], when it only splits into twocreatedAt2is only comparing a string, it has no knowledge of datesI would suggest using Moment.js, as it's excellent for all time/date based operations.
Cheers,
Colin
Thank for you anwser , Now , i found another problem it's my date column can't sort (dd-mm-yyy format) then i tried to use https://datatables.net/blog/2014-12-18 but get this
ERROR TypeError: $.fn.dataTable.moment is not a functionYou need to include the source for MomentJS, see the links here.
i already include MomemntJs(angular-cli.json) but still get
ERRORand i try to include//cdn.datatables.net/plug-ins/1.10.19/sorting/datetime-moment.jsand//cdnjs.cloudflare.com/ajax/libs/moment.js/2.8.4/moment.min.jsin index page too then get sameERRORi'm so confuse what i what i doing wrong. Thank you so much for your anwserHi @theppiwat ,
Would you be able to update your test case to demonstrate this issue, please?
Cheers,
Colin
Hi @colin i just solved my problem. I need to order moment.js before datatable then work fine. Thank you so much for your
https://datatables.net/blog/2014-12-18#Operationlink