OMikkel / tailwind-datepicker-react

A tailwindcss/flowbite datepicker component built as a react component with types
https://omikkel.github.io/tailwind-datepicker-react/
MIT License
160 stars 68 forks source link

any event listener for clear button? #22

Closed SiThu34297 closed 1 year ago

SiThu34297 commented 1 year ago

**I want to know selectedDate changes when i click clear button**

nadamai commented 1 year ago

You can achieve this basing on my comment here: https://github.com/OMikkel/tailwind-datepicker-react/issues/26#issuecomment-1657978337

Just detect whether the clicked element lays within the calendar container and is the clear button, e.g.:

(target.tagName.toLowerCase() === 'button' && target.innerHTML === CLEAR_BUTTON_TEXT)