diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index d4aa69dc30..d7f07d69ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -1040,11 +1040,14 @@ // On-site checkout function toggle_onsite_checkout(){ - const duedatespec_fp = document.querySelector("#duedatespec")._flatpickr; - if ( $("#onsite_checkout").prop('checked') ) { - duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]"); - } else { - duedatespec_fp.setDate(""); + const duedatespec = document.querySelector("#duedatespec"); + if( duedatespec ){ + const duedatespec_fp = duedatespec._flatpickr; + if ( $("#onsite_checkout").prop('checked') ) { + duedatespec_fp.setDate("[% today_due_date_and_time | $KohaDates dateformat => 'iso', with_hours => 1 %]"); + } else { + duedatespec_fp.setDate(""); + } } }