Forward focus event on calendar open

This commit is contained in:
Jean-Baptiste Bellet
2022-09-20 16:17:54 +02:00
committed by Konrad
parent e076e23064
commit ea76615763

View File

@@ -57,6 +57,10 @@ export default class extends Flatpickr {
this.fp.setDate(null);
}
open() {
this.fp.element.dispatchEvent(new Event("focus"));
}
change(selectedDates, dateStr, instance) {
if (this.hasStartTarget && this.hasEndTarget) {
this.startTarget.value = selectedDates[0]