Open leroyiman opened 1 year ago
Having the same issue. tried to implement custom controller - same thing.
I have similar issue. I am trying to use close (aka onClose) hook, but it is triggered immediately when i select a first value in range mode. Nothing is triggered when selecting a second value or on actual close.
Same issue here, I guess there is an issue with Rails 7? Any idea @adrienpoly?
This worked for me with rails@7.1
and stimulus-flatpickr@3.0.0-0
installed via yarn.
import Flatpickr from 'stimulus-flatpickr'
import { Turbo } from "@hotwired/turbo-rails"
import "flatpickr/dist/flatpickr.css";
export default class extends Flatpickr {
static targets = [ "text", "startDate", "endDate" ]
connect() {
super.connect()
}
change(selectedDates, _dateStr, _instance) {
Turbo.visit(`/dates/${selectedDates[0].toISOString().substring(0,10)}`)
}
}
The Problem I have is that my Events are not triggered. The Flatpickr works, but the change Method is not working sadly. Any JS Events are sadly not fired. I want to achieve to have a change method, so when somebody chooses a date or changes it, that I get the selected Day and can check in my available method, which hours are still available.