I have a large dataTable which contains ride information. Every row has a start datetime and an end datetime of the following format(yyyy-mm-dd HH:mm:ss). How can I use a datepicker for setting a filter range in dataTables? I want to have a datepicker which only selects a day and not the time. I've searched everywhere for the proper answer but I couldn't find it. Thanks in advance for helping.
For example I want to see all rows of July by selecting (01-07-2016 - 31-07-2016).
Follow the link below and configure it to what you need. Daterangepicker does it for you, very easily. :)
http://www.daterangepicker.com/#ex1
Here is my solution, there is no way to use momemt.js.Here is DataTable with Two DatePickers for DateRange (To and From) Filter.
Here is
DataTable
with SingleDatePicker
as "from" Date FilterLiveDemo
Here is
DataTable
with TwoDatePickers
for DateRange (To and From) FilterLiveDemo
Here is my solution, cobbled together from the range filter example in the datatables docs, and letting moment.js do the dirty work of comparing the dates.
HTML
JS
Install Moment:
npm install moment
JSFiddle Here
Notes
yyyy-mm-dd
, but you could usemm/dd/yyyy
as well. Be sure to reference moment's docs when parsing other formats, as you may need to modify what method you use.Following one is working fine with moments js 2.10 and above