React-dates: Callback for onClearDates?

Created on 23 Nov 2017  路  2Comments  路  Source: airbnb/react-dates

I have different options on a dropdown: Today, Yesterday, Custom, etc.

  • The dropdown flips to become the date-picker holder on the click of Custom.
  • The flip from Date-picker back to the dropdown will be handled by customCloseIcon by toggling state.

I want the date picker to "callback" my function on clearDates event, i.e. onClearDates could be passed as a prop to the date-picker.

Accepting a PR for this?

Most helpful comment

Yeah I think @erin-doyle's recommendation is on point. You can check if startDate and endDate have both been set to null in onDateChange and do whatever it is you need to do then. I'm not sure if this necessitates a new prop.

All 2 comments

What is it you want to do onClearDates? You could listen to the onDateChange event to know if your date has been cleared.

Yeah I think @erin-doyle's recommendation is on point. You can check if startDate and endDate have both been set to null in onDateChange and do whatever it is you need to do then. I'm not sure if this necessitates a new prop.

Was this page helpful?
0 / 5 - 0 ratings