-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get the selected date using vanilla js #17
Comments
Any help? |
Dude, there documentation is not good, I guess they did this on purpose, in order to make us do upgrade. It seems like there is a method for the Javascript instance if you instanciate the picket with javascript instead of element const dp = new DatePicket(element, {})
dp.getDate() |
One way to listen to value changes is to exntend its class and add your functionality import Datepicker from 'flowbite-datepicker/Datepicker'
class FlowbiteDatepicker extends Datepicker {
constructor(element, options = {}, rangepicker = undefined) {
super(element, options, rangepicker)
this.options = options
}
setDate(...args) {
super.setDate(args);
if (this.options.hasOwnProperty('onSelect')) {
this.options.onSelect(this)
}
}
}
export default FlowbiteDatepicker
// Usage
new FlowbiteDatepicker(element, {
onSelect(instant) {
// Triggered when date is selected
console.log(instant)
}
}) |
Hello, I'm trying to find a way how to get the selected date from the calendar using vanilla js.
I'm using an inline script but unfortunately, I can't find a way to get the selected date from the calendar.
Any help would be appreciated!
The text was updated successfully, but these errors were encountered: