Bug 37542: Fix patron search when dateofbirth is a DefaultPatronSearchField

This patch updates the call to dayjs to use strict parsing for patron search. See https://day.js.org/docs/en/parse/string-format

To test:
1. Create a patron with dateofbirth 1994-07-27
2. Add dateofbirth to DefaultPatronSearchFields
3. In patron or checkout search, type a cardnumber like '2908800092528'
4. Note the patron with that birth date is found in autocomplete
5. Apply patch and restart_all
6. Repeat step 3 and notice the patron is no longer found
7. In patron or checkout search, try searches using a formatted date
8. Confirm searches for '07/27/1994' and '1994-07-27' find the patron

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Brendan Lawlor 2024-08-21 15:52:24 +00:00 committed by Katrin Fischer
parent 5fe1ad8ac6
commit 764162cd6d
Signed by: kfischer
GPG key ID: 0EF6E2C03357A834

View file

@ -91,7 +91,7 @@
window.$date_to_rfc3339 = function(value, options) {
var dateformat = (options&&options.dateformat)||def_date_format;
let m = dayjs(value, get_date_pattern(dateformat));
let m = dayjs(value, get_date_pattern(dateformat), true);
return m.format("YYYY-MM-DD");
}