Cannot filter from date to date on firefox

Cannot filter from date to date on firefox

Ezo12Ezo12 Posts: 1Questions: 1Answers: 0
edited April 2021 in Free community support

The filter still works on firefox, but when the filter is different from the year e.g. from (10-June-2019) to (30-June-2020) the results will not be displayed, but if the filter is on the same year it will show the results for the year That's for example (10-June-2019) to (June 30, 2019).
On chrome it works very well but on Firefox it doesn't

                        $(function() {
                            var tables = $('#candidateTable').DataTable();
                            minDate = new DateTime($('#colfilter5'), {
                                format: 'DD-MMM-YYYY'
                            });
                            maxDate = new DateTime($('#max'), {
                                format: 'DD-MMM-YYYY'
                            });
                            $('#colfilter5').on('dp.change', function() {
                                tables.draw();
                            });

                            $('#max').on('dp.change', function() {
                                tables.draw();
                            });
                            $.fn.dataTable.ext.search.push(
                                function( settings, data, dataIndex ) {
                                    var min = minDate.val() ? new Date($('#colfilter5').val()) : null;
                                    var max = maxDate.val()? new Date($('#max').val()) : null;
                                    var date = new Date( data[5] );
                                    if (min == null && max == null) {
                                        return true;
                                    }
                                    if (min == null && date <= max) {
                                        return true;
                                    }
                                    if (max == null && date >= min) {
                                        return true;
                                    }
                                    if (date <= max && date >= min) {
                                        return true;
                                    }
                                    return false;
                                }
                            );
                        });///

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    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

This discussion has been closed.