Date range filter with dd-mm-yyyy format
Date range filter with dd-mm-yyyy format
Blackbull256
Posts: 4Questions: 2Answers: 0
Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: I want to add a date filter to my datatable. I used the example posted here, but I can't get it to work with the dd-mm-yyyy date notation. Does anyone have a working example of a date range filter with this notation?
This question has an accepted answers - jump to answer
Answers
http://live.datatables.net/polaloto/2/edit
Modified the range filter from the demo to use the DD-MM-YYYY format.
Also replaced 6-7 with new lines 6-12 to fix a bug where it was not zero'ing out the time on date filters.
If you include Moment.js
in your js scripts you can replace 6-12 with this for better filtering (the below code will return no records on a badly formatted date on the min/max inputs)
Hey Josh,
Thanks for your answer. I have created a test case with the date format in my application, and your solution does not quite seem to work. Do you have any idea why?
http://live.datatables.net/jewumadi/1/edit
There were a few problems, mostly due to the mixing of the Date and Moment formats, which meant the checks weren't using "DD-MM-YYYY". I tidied it up and this appears to be doing what you're after: http://live.datatables.net/jewumadi/2/edit
Colin
Thanks Colin, this works perfectly!