Skip to content
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

Handling flatpickr hooks #44

Closed
KolbySisk opened this issue May 31, 2018 · 3 comments
Closed

Handling flatpickr hooks #44

KolbySisk opened this issue May 31, 2018 · 3 comments

Comments

@KolbySisk
Copy link

Flatpickr documentation has a page with hooks

In their example you can use onChange to get selectedDates, dateStr, instance

onChange: function(selectedDates, dateStr, instance) {
        //...
},

Is there a way to use these hooks? A way I can access selectedDates, dateStr, instance? Or should just rely on input.value?

Thanks

@KolbySisk
Copy link
Author

Figured out that you can pass an onChange function in the config object. Maybe a section could be added to the documentation dedicated to getting the selected values.

@rdelriods01
Copy link

Hi @KolbySisk could you explain how did you use the onChange function please? How can I set the selectedDates or the dateStr to a variable in my Component?

@KolbySisk
Copy link
Author

@rdelriods01 Just add a function to your config.

datePickerConfig = {
    onChange: (selectedDates, dateStr, instance) => {
      console.log(selectedDates);
    }
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants