Bug 35559: Correctly parse previous flatpickr date
authorEmily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Sun, 24 Mar 2024 20:07:16 +0000 (16:07 -0400)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Thu, 2 May 2024 11:19:16 +0000 (13:19 +0200)
commit54d884819121ecb18930bbf250dfbb21fc7ecb93
treeb932b27f32194286b11282facce6c6d5a3d731d9
parent33465f2f7ae0d00775a207b793037fc15b89177d
Bug 35559: Correctly parse previous flatpickr date

The Flatpickr configuration for futuredate and futuredateinclusive is
meant to allow the preexisting date, even if it is in the past, to avoid
data loss. As of Bug 30718 - Use flatpickr's alt option everywhere,
that incoming date is in yyyy-mm-dd format, not the configured
human-readable format, and needs to be parsed accordingly.

To test:
1. Place 2 holds on the same bib, both with an expiration date set
2. Set the expiration date for one of the holds to a date in the past
   (e.g., in Koha Testing Docker, use the commands:
   ktd --shell
   koha-mysql kohadev
   to access the database directly)
3. Reload the holds tab for that bib
--> Note that the future expiration date will be editable, and the past
    expiration date will not be editable
4. In a new tab, go to Administration > Patron Categories
5. Edit one patron category to have an enrolment period date in the future
6. Edit another patron category to have an enrolment period date in the
   past (e.g. by accessing the database directly, as above)
7. Reload the Edit pages for each of the above categories (in new tabs)
--> Note that the future enrolment period date will be retained in the
    date field, but the past enrolment period date will be blanked out
8. Apply this patchset
9. Refresh the holds tab from step 3
--> Note that both expiration dates are now editable
10. Refresh the 2 patron category tabs from step 7
--> Note that both enrolment dates are now retained correctly
11. Open the date picker on one of the date fields that has a past date
--> Note that other past dates, besides the existing date, are prevented

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc