catc/react-timekeeper

Updating time from outside timekeeper's onChange, new time is lost on next change

ecrookoh opened this issue · 0 comments

Hi,

I've run into an issue when updating the time for the timekeeper from outside the timekeeper component while using v.2.2.1. The new time will show up on the clock, but when I try to change either the hour or the minute, part of the time will revert back to the initial value that was set for the timekeeper.

I created a CodeSandbox that shows the issue: https://codesandbox.io/s/sweet-tamas-q0jc2e?file=/src/App.js
Steps to reproduce:

  1. Click "Update Time Outside" button. Time should be shown as 11:15 AM.
  2. Change hour to a new value. Minutes shown on the clock will revert to the initial value of ":34". Using the hour dropdown or the hour hand to change the time gives the same result.

The same issue shows up when the time is updated from outside and then the minute is changed. In that case the hour is reverted to the initial value.

I tested previous version of the timekeeper to see how far back this issue occurred. The first version where it shows up is 2.2.0.
Version 2.1.3 does not seem to have the problem.

Please let me know if there is an alternate way that I should be updating the time from outside the Timekeeper, or if you need any other information.