When parsing patron search we try to convert the input into a date for searching against dateofbirth if included in defaultpatronsearchfields This can lead to odd values being converted to incorrect dates. To recreate" 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 - Open the browser console (F12) 6 - In the network tab, find the last request (or just remove and add a digit) 7 - Copy the URL from that request and paste into a text editor 8 - Search for 'dateofbirth' 9 - See that the entry has been converted to 1994-07-27
Created attachment 170571 [details] [review] 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
Created attachment 170609 [details] [review] 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>
Trivial patch, big impact, moving to PQA
Pushed for 24.11! Well done everyone, thank you!
Backported to 24.05.x for upcoming 24.05.04
I would like to note that the test plan focuses on dob patron search, but date_to_rfc is actually use for all the date searches using DT/REST API. As well in UsageStatisticsDataProvidersList.vue. Side-effects are possible. However I think it's a correct change, maybe we should also apply it to other functions from js-date-format.inc
I prefer not impact oldstable since side-effects are possible