Open event that emit when the popup is shown
In the documentation, I see that there is a close event but there is no open event.
What I am trying to do is the following: I want to set the max datetime to the current datetime. The component is rendered in the screen and there are multiple inputs to fill so when the user reaches the datetime picker, the max date time is 2 or 3 minutes behind the current date time.
For this reason I want to set it when the popup is opened.
Did you find a way?
This would be a very helpful event.
Looks like PR #175 would address this, but the owner of this repo requested that the author update the README and add tests, but the author of the PR hasn't followed up.
Here's the workaround I've been using...
mounted() {
const datetimeElement = document.getElementsByClassName("vdatetime")[0];
datetimeElement.addEventListener("click", (event) => {
if (event.target.className === "vdatetime datetime") {
this.handleOpen();
}
});
},
methods {
handleOpen() {
// do something...
}
}
You need the event.target.className === "vdatetime datetime" conditional because, once the picker is open, clicks on the modal backdrop will be registered by this event handler.