@@ -, +, @@ column - it's also working for "Expires on" on the same table. We may want to - You need to search for the full formatted date to make it work. --- .../prog/en/includes/patron-search.inc | 4 +-- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 25 ++++++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -150,14 +150,14 @@ [% SWITCH column %] [% CASE 'checkbox' %] [% CASE 'cardnumber' %]Card - [% CASE 'dateofbirth' %]Date of birth + [% CASE 'dateofbirth' %]Date of birth [% CASE 'name' %]Name [% CASE 'name-address' %]Name [% CASE 'address' %]Address [% CASE 'address-library' %]Address [% CASE 'branch' %]Library [% CASE 'category' %]Category - [% CASE 'dateexpiry' %]Expires on + [% CASE 'dateexpiry' %]Expires on [% CASE 'borrowernotes' %]Notes [% CASE 'phone' %]Phone [% CASE 'checkouts' %]Checkouts --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ a/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -597,9 +597,28 @@ jQuery.fn.dataTable.ext.errMode = function(settings, note, message) { // escape SQL LIKE special characters % and _ value = value.replace(/(\%|\\)/g, "\\$1"); } - part[!attr.includes('.')?'me.'+attr:attr] = criteria === 'exact' - ? value - : {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')}; + + let built_value; + if ( col.datatype !== undefined ) { + if ( col.datatype == 'date' ) { + let rfc3339 = $date_to_rfc3339(value); + if ( rfc3339 != 'Invalid Date' ) { + built_value = rfc3339; + } + } else { + console.log("datatype %s not supported yet".format(col.datatype)); + } + } + + let value_part; + if ( criteria === 'exact' ) { + value_part = built_value ? [value, built_value] : value + } else { + let like = {like: (['contains', 'ends_with'].indexOf(criteria) !== -1?'%':'') + value + (['contains', 'starts_with'].indexOf(criteria) !== -1?'%':'')}; + value_part = built_value ? [like, built_value] : like; + } + + part[!attr.includes('.')?'me.'+attr:attr] = value_part; parts.push(part); } return parts; --