arfedulov / semantic-ui-calendar-react

Datepicker react component based on semantic-ui-react components
https://arfedulov.github.io/semantic-ui-calendar-react/
MIT License
260 stars 92 forks source link

No Programmatic way to close a time picker popup? #221

Open mpaccione opened 3 years ago

mpaccione commented 3 years ago

We have to have validation to ensure that someone doesn't pick an end date that comes before a start date.

Currently if we prevent the value from setting the second stage for setting minutes in the time picker gets bugged. It arbitrarily picks an hour selector despite us setting the controlled value to a blank string "".

I've tried using a ref to de-focus / blur the input in hopes that the popup would disappear however it doesn't. I also tried a direct click() on the modal component to simulate a click outside of the input but that too does not close the picker.

What is the approach to programmatically close the time picker popup?

DovahBrownies commented 3 years ago

Hey @mpaccione . Sorry to be the bearer of bad news but this repo is basically dead and I myself am not a member of the core team or anything; I was just helping out when I could.

I haven't used this library in a very long time and have stopped using it long ago due to the complications.

I watched your video demonstration of the bug and I would advise you either change the library from this one to another, or implement a janky work around:

Option 1 I don't remember if minDate has an effect on the tome Picker but it's worth looking into: Just set the date as anything: 01/01/01

Option 2 When picking an invalid time, you could:

And I think that would force close the minutes popup.

I know it's super janky but that's all I have for you right now as I don't even remember the code logic at all.

Sorry.

DovahBrownies commented 3 years ago

To be honest, you're better off forking this repo and making the appropriate changes yourself. That's what I did when we were actually using this project back in the day.