mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-01 02:03:22 +00:00
Send change event on flatpickr widget close
This commit is contained in:
committed by
Konrad
parent
263b36d1d9
commit
f5ebc797c4
@@ -62,7 +62,7 @@ export default class extends Flatpickr {
|
||||
}
|
||||
|
||||
change(selectedDates, dateStr, instance) {
|
||||
if (this.hasStartTarget && this.hasEndTarget) {
|
||||
if (this.hasStartTarget && this.hasEndTarget && this.modeValue == "range") {
|
||||
this.startTarget.value = selectedDates[0]
|
||||
? this.fp.formatDate(selectedDates[0], this.config.dateFormat)
|
||||
: "";
|
||||
@@ -78,6 +78,11 @@ export default class extends Flatpickr {
|
||||
}
|
||||
}
|
||||
|
||||
close() {
|
||||
// Send a change event to the input element to trigger the ng-change
|
||||
this.hasEndTarget && this.endTarget.dispatchEvent(new Event("change"));
|
||||
}
|
||||
|
||||
// private
|
||||
|
||||
plugins = (mode, datetimepicker) => {
|
||||
|
||||
Reference in New Issue
Block a user