Bug 38027: (QA follow-up) Fix flatpickr onChange when input is cleared

With the onChange event handler fixed, it's ok to call clear() instead
of setDate('')

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit b892af285b)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Julian Maurice 2024-10-04 16:03:32 +02:00 committed by Lucas Gass
parent 11e025e40a
commit eb39ce87ca
1 changed files with 5 additions and 1 deletions

View File

@ -74,7 +74,7 @@
.addClass("clear_date")
.on("click", function(e){
e.preventDefault();
instance.setDate('');
instance.clear();
})
.addClass("fa fa-fw fa-times")
.attr("aria-hidden", true)
@ -110,6 +110,10 @@
new Maskito( instance.altInput, maskitoOptions );
},
onChange: function( selectedDates, dateText, instance) {
if (selectedDates.length === 0) {
return;
}
var thisInput = instance.input;
let accepts_time = $(thisInput).data('flatpickr-enable-time');
let accepts_period = $(thisInput).data('flatpickr-period');