Laravel, Date range filter between two column

  jquery, laravel

Hello i would like to filter date range from two different column, here is my current filter date :

$(document).ready( function(){
         $.fn.dataTable.ext.search.push(
                function (settings, data, dataIndex){
                    var datepicker_to = $('#datepicker_to').datepicker("getDate");
                    var datepicker_from = $('#datepicker_from').datepicker("getDate");
                    var startDate = new Date(data[20]);

                    if (datepicker_from == null && datepicker_to == null) {return true; }
                    if (datepicker_from == null && startDate <= datepicker_to) {return true; }
                    if (datepicker_to == null && startDate >= datepicker_from) {return true; }
                    if (startDate <= datepicker_to && startDate >= datepicker_from) {return true; }
                    return false;
                }
            );

            $('#datepicker_from, #datepicker_to').change(function() {
                    tableMediaOrder.draw();
                });
            });

so far im only able to filter date range form one column which the column that being filtered is column Date(data[20]); which is created_at column, is there a way to filter date range between two column like for my case is periode_start and periode_end?

here is the column :

periode_start and periode_end

thank you!.

Source: Laravel

Leave a Reply