For instance if a hold is expired (expirationdate in the past), the date input will be blanked. To recreate: Place a hold Edit its expirationdate and set a date in the past (yesterday is fine) Go to /reserve/request.pl?biblionumbers=42 Notice that the expirationdate is not displayed
Things to try (but bug 29240 needs to be fixed first): * Use "enable" with expirationdate AND minDate # would be weird but worst to test * Use "enable" with "expirationdate", {from: today_date} # Does it work without to? https://flatpickr.js.org/examples/#supplying-dates-for-flatpickr
https://flatpickr.js.org/options/ allowInvalidPreload Boolean false Allows the preloading of an invalid date. When disabled, the field will be cleared if the provided date is invalid
(In reply to Jonathan Druart from comment #2) > https://flatpickr.js.org/options/ > > allowInvalidPreload Boolean false Allows the preloading of an invalid date. > When disabled, the field will be cleared if the provided date is invalid It did not work when I was setting in from onReady, but it works when it's passed to the constructor.
Created attachment 126260 [details] [review] Bug 29241: Use allowInvalidPreload to allow date in the past
This patch is the way to go.
Created attachment 126268 [details] [review] Bug 29241: Use allowInvalidPreload to allow date in the past
Created attachment 126473 [details] [review] Bug 29241: Allow display of past date for .futuredate When a past date is set for a flatpickr instance with the .futuredate class, only dates in the future are available AND the input is blanked. It does not display the date in the past. For instance if a hold is expired (expirationdate in the past), the date input will be blanked. We can use the flatpickr's allowInvalidPreload option to allow date in the past to be displayed. Test plan: Place a hold Edit its expirationdate and set a date in the past (yesterday is fine) Go to /reserve/request.pl?biblionumbers=42 => With the patch you see the date, and the widget let you chose anoter date, in the future => Without this patch the expiration date is not displayed
Created attachment 126674 [details] [review] Bug 29241: Allow display of past date for .futuredate When a past date is set for a flatpickr instance with the .futuredate class, only dates in the future are available AND the input is blanked. It does not display the date in the past. For instance if a hold is expired (expirationdate in the past), the date input will be blanked. We can use the flatpickr's allowInvalidPreload option to allow date in the past to be displayed. Test plan: Place a hold Edit its expirationdate and set a date in the past (yesterday is fine) Go to /reserve/request.pl?biblionumbers=42 => With the patch you see the date, and the widget let you chose anoter date, in the future => Without this patch the expiration date is not displayed Signed-off-by: David Nind <david@davidnind.com>
Testing notes (koha-testing-docker): - date picker doesn't let you go back past the current date - entering date manually works (and is retained) after patch is applied
Created attachment 126795 [details] [review] Bug 29241: Allow display of past date for .futuredate When a past date is set for a flatpickr instance with the .futuredate class, only dates in the future are available AND the input is blanked. It does not display the date in the past. For instance if a hold is expired (expirationdate in the past), the date input will be blanked. We can use the flatpickr's allowInvalidPreload option to allow date in the past to be displayed. Test plan: Place a hold Edit its expirationdate and set a date in the past (yesterday is fine) Go to /reserve/request.pl?biblionumbers=42 => With the patch you see the date, and the widget let you chose anoter date, in the future => Without this patch the expiration date is not displayed Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Pushed to master for 21.11, thanks to everybody involved!
Unfortunately there is a problem with this patch. The futuredate class add both minDate and allowInvalidPreload. It fix the original problem describes here, but it also permits the user to enter invalid (in the past) dates.
(In reply to Jonathan Druart from comment #12) > Unfortunately there is a problem with this patch. The futuredate class add > both minDate and allowInvalidPreload. It fix the original problem describes > here, but it also permits the user to enter invalid (in the past) dates. See bug 29500.