The instantiation must be done by the JS from calendar.inc, based on the classes of the inputs.
Created attachment 127683 [details] [review] Bug 29394: Remove flatpickr instantiations from most of the tt files We must reduce the instantiations as much as possible to take advantages of the default values and specific behaviours we have defined in calendar.inc This patch is suggesting to have a .flatpickr class and using the data attributes: - flatpickr-futuredate - flatpickr-pastdate - flatpickr-enable-time - flatpickr-on-close-focus
Owen, Martin, this is what I had in mind. Do you agree with the idea?
Created attachment 127699 [details] [review] Bug 29394: (follow-up) Pass correct time format and other corrections This patch makes a few corrections, including adding the correct Flatpickr date format option when the timepicker is enabled. The patch also corrects a couple of places where the wrong date field was modified with the new data attributes. To test, apply the patch and test the datepickers on the batch checkout and renew pages. When you select a date and time the "TimeFormat" system preference should be correctly applied.
Created attachment 127700 [details] [review] Bug 29394: (follow-up) Pass correct time format and other corrections This patch makes a few corrections, including adding the correct Flatpickr date format option when the timepicker is enabled. Besides past and future date options, I've added a "pastinclusive" option which allows dates in the past OR today. This option was previously applied to the checkin page. The patch also corrects a couple of places where the wrong date field was modified with the new data attributes. To test, apply the patch and test the datepickers on the batch checkout and renew pages. When you select a date and time the "TimeFormat" system preference should be correctly applied. The calendar widget on the checkin page should allow you to select today's date.
One problem I wasn't able to understand: If you configure an input with the "pastdate" or "pastinclusive" option AND enable the time picker the defaultHour and defaultMinute options are lost.
Created attachment 127707 [details] [review] Bug 29394: adjust request.tt
<div><label for="hard_due_date" class="hint">Renewal due date [% INCLUDE 'date-format.inc' %]:</label></div> - <input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | $KohaDates with_hours => 1 %]" /> + <input type="text" size="20" id="hard_due_date" name="hard_due_date" value="[% hard_due_date | $KohaDates with_hours => 1 %]" class="flatpickr" data-flatpickr-futuredate="true" data-flatpickr-enable-time="true" /> I think this is wrong, before this patchset we didn't have a "future" restriction on the renewal due date.
Created attachment 127715 [details] [review] Bug 29394: Remove futuredate for renew
(In reply to Owen Leonard from comment #5) > One problem I wasn't able to understand: If you configure an input with the > "pastdate" or "pastinclusive" option AND enable the time picker the > defaultHour and defaultMinute options are lost. I think that's because because TODAY 23:59 is in the future :-/
Created attachment 127716 [details] [review] Bug 29394: Remove flatpickr instantiations from most of the tt files We must reduce the instantiations as much as possible to take advantages of the default values and specific behaviours we have defined in calendar.inc This patch is suggesting to have a .flatpickr class and using the data attributes: - flatpickr-futuredate - flatpickr-pastdate - flatpickr-enable-time - flatpickr-on-close-focus
Created attachment 127717 [details] [review] Bug 29394: (follow-up) Pass correct time format and other corrections This patch makes a few corrections, including adding the correct Flatpickr date format option when the timepicker is enabled. Besides past and future date options, I've added a "pastinclusive" option which allows dates in the past OR today. This option was previously applied to the checkin page. The patch also corrects a couple of places where the wrong date field was modified with the new data attributes. To test, apply the patch and test the datepickers on the batch checkout and renew pages. When you select a date and time the "TimeFormat" system preference should be correctly applied. The calendar widget on the checkin page should allow you to select today's date.
Created attachment 127718 [details] [review] Bug 29394: adjust request.tt
Created attachment 127719 [details] [review] Bug 29394: Remove futuredate for renew
Created attachment 127723 [details] [review] Bug 29394: Remove flatpickr instantiations from most of the tt files We must reduce the instantiations as much as possible to take advantages of the default values and specific behaviours we have defined in calendar.inc This patch is suggesting to have a .flatpickr class and using the data attributes: - flatpickr-futuredate - flatpickr-pastdate - flatpickr-enable-time - flatpickr-on-close-focus Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 127724 [details] [review] Bug 29394: (follow-up) Pass correct time format and other corrections This patch makes a few corrections, including adding the correct Flatpickr date format option when the timepicker is enabled. Besides past and future date options, I've added a "pastinclusive" option which allows dates in the past OR today. This option was previously applied to the checkin page. The patch also corrects a couple of places where the wrong date field was modified with the new data attributes. To test, apply the patch and test the datepickers on the batch checkout and renew pages. When you select a date and time the "TimeFormat" system preference should be correctly applied. The calendar widget on the checkin page should allow you to select today's date. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 127725 [details] [review] Bug 29394: adjust request.tt Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 127726 [details] [review] Bug 29394: Remove futuredate for renew Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
It looks to me as though Martin has signed this off - have changed the status. Feel free to change back and I will test.
Also needs to be a 21.11 candidate because of dependencies.
(In reply to David Nind from comment #18) > It looks to me as though Martin has signed this off - have changed the > status. Feel free to change back and I will test. Thanks David, you're right.. I had just forgotten to change the state.
Skipping QA, we need it pushed ASAP
Pushed to master for 21.11, thanks to everybody involved!