arqex/react-datetime

The time picker hit some race condition and is buggy when using a controlled value

paintoshi opened this issue · 0 comments

I'm Submitting a ...

[ x ] Bug report
[ ] Feature request
[ ] Support request

Steps to Reproduce

I'm using the datepicker value in order to update it programmatically. From what I can find on the docs, this should be the correct way of doing it.

const [curentDate, setCurentDate] = React.useState(initValue)
const onChangeDate = (date: any) => {
    setCurentDate(date)
}
<Datetime
    value={curentDate}
    onChange={onChangeDate}
    ....

Expected Results

Selecting a date and time should be smooth.

Actual Results

Selecting the date is fine, but when increasing/desceasing hours/min it works about 50% of the time. It instantly switches back to the previous value. Removing "value" from the datePicker and using the initalValue instead solves the problem, but then I can't change the date from other components.

chrome_1pYEedriDb.mp4