JBAS-1705 New headings search excludes 12am next day
authorBill Erickson <berickxx@gmail.com>
Thu, 2 Feb 2017 17:25:01 +0000 (12:25 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Search for headings with dates < end-date + 1 day, instead of <= (or
between) so that 12am next day is not included.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/web/js/ui/default/cat/authority/new_headings.js

index bb2e18a..b154511 100644 (file)
@@ -166,14 +166,18 @@ function compile_date_filter() {
         end_date = openils.Util.getYMD(end_date);
     }
 
-    var date_filter = {heading_date : {}};
+    var date_filter = {}
 
     if (start_date && end_date) {
-        date_filter.heading_date = {between : [start_date, end_date]}
+        // use -and instead of BETWEEN so that end_date is not inclusive.
+        date_filter['-and'] = [
+            {heading_date : {'>=' : start_date}},
+            {heading_date : {'<' : end_date}}
+        ];
     } else if (start_date) {
         date_filter.heading_date = {'>=' : start_date};
     } else {
-        date_filter.heading_date = {'<=' : end_date};
+        date_filter.heading_date = {'<' : end_date};
     }
 
     return date_filter;