Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time cannot be set via typing since v6.3.0 #4588

Closed
blanser-cc opened this issue Mar 12, 2024 · 0 comments · Fixed by #4610
Closed

Time cannot be set via typing since v6.3.0 #4588

blanser-cc opened this issue Mar 12, 2024 · 0 comments · Fixed by #4610

Comments

@blanser-cc
Copy link
Contributor

Describe the bug
Since the update to v6.3.0, we have noticed that when minTime is set, it is no longer possible to set the time by typing it into the input field: As soon as the input field loses focus, the time value displayed changes to the given minTime value.

Setting the date via typing still works just fine, as does setting the time by clicking the respective item in the selection list.

It seems that this issue is due to the changes in this pull request; in particular, when we use a custom version of react-datepicker where the following lines in src/index.jsx are removed, the issue disappears:

// If minTime is present then set the time to minTime
        if (this.props.showTimeSelect || this.props.showTimeSelectOnly) {
          if (minTime) {
            changedDate = setTime(changedDate, {
              hour: minTime.getHours(),
              minute: minTime.getMinutes(),
              second: minTime.getSeconds(),
            });
          }
        }

To Reproduce
I have prepared a sandbox with an example datepicker that can be used to reproduce the behavior.

Steps to reproduce the behavior:

  1. Click into the input field.
  2. Replace the current time displayed with any other value (e.g. 10:00)
  3. Click outside of the input field.
  4. The time displayed changes to 06:00, which corresponds to the minTime value set in the example.

Expected behavior
The time displayed should be the time that the user typed in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant