Bug 20600: (follow-up) Fix filtering

There was a bug whereby filtering by date would fail if the selected
date syspref was set to dmydot or metric. Rather than use the display
date value, We now use the non-display date value that is always in
a predictable ISO8601 format to construct the Date objects used
for comparison.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Andrew Isherwood 2018-06-06 10:45:44 +01:00 committed by Nick Clemens
parent acffc1c195
commit 2153b8c8cf

View file

@ -415,7 +415,7 @@
{ // Hide the two date columns we use just for sorting
'aTargets': [ 'placed', 'updated' ],
'bVisible': false,
'bSearchable': false
'bSearchable': true
},
{ // When sorting 'placed', we want to use the
// unformatted column
@ -456,12 +456,13 @@
// Custom date range filtering
$.fn.dataTable.ext.search.push(function(settings, data, dataIndex) {
console.log(data);
var placedStart = $('#illfilter_dateplaced_start').datepicker('getDate');
var placedEnd = $('#illfilter_dateplaced_end').datepicker('getDate');
var modifiedStart = $('#illfilter_datemodified_start').datepicker('getDate');
var modifiedEnd = $('#illfilter_datemodified_end').datepicker('getDate');
var rowPlaced = data[8] ? new Date(data[8]) : null;
var rowModified = data[10] ? new Date(data[10]) : null;
var rowPlaced = data[7] ? new Date(data[7]) : null;
var rowModified = data[9] ? new Date(data[9]) : null;
var placedPassed = true;
var modifiedPassed = true;
if (placedStart && rowPlaced && rowPlaced < placedStart) {