arqex / arqex/react-datetime

Cannot change the date string inside the input with onChange function

Open
#641 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2k
Forks
858
PR merge metrics
No merged PRs in 30d

Description

### I'm Submitting a ...

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

### Steps to Reproduce

1. set initial state with moment(), `state = { date: moment() }`
2. set value of DateTime componenet with `this.state.date`
3. onChange function is `onChange={value => this.setState(date: value}}`
3. Edit the date/time string in the input (not the popup), hit backspace or highlight any part of the date or time and try to edit

### Expected Results

If the user hits the backspace button or tries to edit any part of the date inside the input then the onChange prop should put the correct value (string) in the state

### Actual Results

If the date that is represented by the string `07/01/2019 6:35 PM` and I put the cursor at the end of the string and hit the backspace button, nothing happens. When I highlight the minutes, for example `:35` and change it to `:36`, then the output becomes `07/01/2019 6:03 PM`

### Minimal Reproduction of the Problem

### Other Information (e.g. stacktraces, related issues, suggestions how to fix)

If I use `onBlur` instead of `onChange` then the editing of the date string inside the input works, but then the Date/Time popup cannot set the date in the state

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.