Bug 36488

Summary: Flatpickr creates invalid date entries
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: TemplatesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: andrew, christian.stelzenmueller, jonathan.druart, lisette, lucas, marie.hedbom
Version: 22.11   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36466
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27768
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35957
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Katrin Fischer 2024-04-02 08:20:38 UTC
I believe that in some conditions flatpickr creates invalid date entries that can be saved.

To test:
* Switch DateFormat to DD.MM.YYY 
* Go to the OPAC self registration form
* Enter a date of 00.00.000
* It will show as: 30.12.00-1 in the input and can be saved

We have seen something similar on bug 36466.
Comment 1 Katrin Fischer 2024-05-21 07:27:07 UTC
This breaks patron search and is nothing the library can fix themselves, it needs to be fixed within the database. Upping severity.
It's also happening quite frequently.
Comment 2 Jonathan Druart 2024-05-21 09:50:49 UTC
Confirmed on main? I don't recreate.
Comment 3 Jonathan Druart 2024-05-21 09:51:25 UTC
It inserted "0001-01-01" and search is not broken.
Comment 4 Katrin Fischer 2024-05-21 09:52:35 UTC
(In reply to Jonathan Druart from comment #3)
> It inserted "0001-01-01" and search is not broken.

We end up with 0000-00-00 in these cases in dateofbirth.
It happens in 22.11.16 reliably.
Comment 5 Katrin Fischer 2024-05-21 09:54:00 UTC
I have tried to find a way to replicate the issue, we are not sure what exactly the people registering are entering to cause the date, but it has happened at least 3 times now on different servers/instances.

We are using the DD.MM.YYYY DateFormat - not sure if that could make a difference?
Comment 6 Jonathan Druart 2024-05-21 10:33:20 UTC
On 22.11.16, Using "00000000" make fp displays "30.12.00-1", save and get:

Invalid value passed, borrowers.dateofbirth=00-1-12-30 expected type is date at /usr/share/perl5/Exception/Class/Base.pm line 88

So I guess it depends on the DBMS version.
Comment 7 Jonathan Druart 2024-05-21 10:34:10 UTC
Sounds like a duplicate of bug 27768.
Comment 8 Jonathan Druart 2024-05-21 10:34:36 UTC
Maybe bug 33703 is causing the behaviour difference between main and 22.11.16
Comment 9 Katrin Fischer 2024-05-21 11:04:00 UTC
Hm, more to investigate.

We are currently updating to a newer Debian version which should also include a newer version of MariaDB. Maybe this will make a difference.
Comment 10 Katrin Fischer 2024-06-20 14:46:00 UTC
*** Bug 37142 has been marked as a duplicate of this bug. ***
Comment 11 Katrin Fischer 2024-06-24 07:08:00 UTC
This regularly kills patron search in our installation using self registration.
Comment 12 Lucas Gass (lukeg) 2024-06-25 14:26:35 UTC
I have tried, without success, to recreate this on the OPAC self reg page in main.
Comment 13 Katrin Fischer 2024-06-25 14:28:03 UTC
Yes, I think we are missing something either in configuration or setup (DBMS version) that causes this :(
Comment 14 Jonathan Druart 2024-07-10 14:33:57 UTC
Lowering severity as we have trouble to replicate the problem. Please provide more information.
Comment 15 Katrin Fischer 2024-07-11 09:54:19 UTC
We've had at least 5 cases from different libraries on different servers running 22.11 so far. I think we need to keep trying to replicate as this is a real issue. Also other reports on mailing list/Mattermost about invalid dates.
Comment 16 Christian Stelzenmüller 2024-07-15 13:41:04 UTC
I couldn't manage to enter an invalid date in a sandbox (24.06.00) either. 

But i was able to in our test-environment in 22.11.

You can type in the date with zero's - in our case in the date-format DD.MM.YYYY. So it was 00.00.0000. It wasn't possible to do that in 24.06. I don't know if there's another way to enter the invalid date. But this way - typing in - was doable in 22.11. I have tested that in Firefox and Edge.