@@ -, +, @@ from Bug 29240 --- .../bootstrap/en/includes/calendar.inc | 20 +++++------------ .../bootstrap/en/modules/opac-reserve.tt | 22 ++----------------- 2 files changed, 8 insertions(+), 34 deletions(-) --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc +++ a/koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc @@ -80,7 +80,12 @@ }); }, onClose: function( selectedDates, dateText, instance) { - validate_date( selectedDates, instance ); + validate_date( dateText, instance ); + var thisInput = instance.input; + if ( thisInput.hasAttribute('data-start_for') ) { + var endPicker = document.querySelector("#"+thisInput.dataset.start_for)._flatpickr; + endPicker.set('minDate', selectedDates[0]); + } }, }); @@ -120,20 +125,7 @@ } $(document).ready(function(){ - $(".flatpickr").flatpickr(); - var startPicker = $(".flatpickrfrom").flatpickr({ - onClose: function( selectedDates, dateText, instance) { - validate_date( selectedDates, instance ); - endPicker.set('minDate', selectedDates[0]); - } - }); - var endPicker = $(".flatpickrto").flatpickr({ - onClose: function( selectedDates, dateText, instance) { - validate_date( selectedDates, instance ); - }, - }); }); - --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt +++ a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt @@ -281,14 +281,14 @@ [% IF ( reserve_in_future ) %]
  • - + [% INCLUDE 'date-format.inc' %]
  • [% END %]
  • - + [% INCLUDE 'date-format.inc' %]
  • @@ -669,24 +669,6 @@ return true; }); - [% FOREACH bibitemloo IN bibitemloop %] - [% IF ( bibitemloo.holdable ) %] - - var startPicker[% bibitemloo.biblionumber | html %] = $("#from[% bibitemloo.biblionumber | html %]").flatpickr({ - onClose: function( selectedDates, dateText, instance) { - validate_date( selectedDates, instance ); - endPicker[% bibitemloo.biblionumber | html %].set('minDate', selectedDates[0]); - } - }); - var endPicker[% bibitemloo.biblionumber | html %] = $("#to[% bibitemloo.biblionumber | html %]").flatpickr({ - onClose: function( selectedDates, dateText, instance) { - validate_date( selectedDates, instance ); - }, - }); - - [% END %] - [% END %] - }); [% END %] --