onefinestay / react-daterange-picker

Other
563 stars 209 forks source link

how to reset selected date? #182

Closed cunjieliu closed 6 years ago

cunjieliu commented 6 years ago

how to reset(or init) selected date?

dananw commented 6 years ago

Hi, I experienced the same thing

first set onSelect to function image

image

if you want to reset selected date, just setState value to null. like this image

AlanFoster commented 6 years ago

Is this still an issue? Happy to accept a PR with tests that resolves this if there is a bug in react-daterange-picker :+1:

james-ff commented 6 years ago

Hello, I'm finding that when I set value to null in setState (3rd image above) it complains with the following error, strangely this does not happen with value set to null in the constructor (state default values):

TypeError: Cannot read property 'start' of null