arqex / arqex/react-datetime

Prop displayTimeZone causes inability to type in date field

Open
#798 0 comments 1 reaction 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
[ ] Support request
```

### Steps to Reproduce
Using the following Code Sandbox:
https://codesandbox.io/s/still-cdn-vqoyj?file=/src/App.js

- Click in the react-datetime text field
- Begin typing a valid date/time (e.g. 2021-07-07 00:00:00)

### Expected Results
I'm able to type the date/time and the calendar will highlight the 7th of July

### Actual Results
As soon as I type the first 2, the field re-formats to "0002-01-01 00:00:00" and any further keypresses are lost.

### Minimal Reproduction of the Problem
https://codesandbox.io/s/still-cdn-vqoyj?file=/src/App.js

### Other Information (e.g. stacktraces, related issues, suggestions how to fix)
When the displayTimeZone prop is not set, the value received by the onChange function remains a string until I finish typing the entire dateTime. When displayTimeZone is set, onChange returns a moment as soon as I type a "2", which seems odd. Maybe this is a parsing issue with moment tz and not a react-datetime issue? I'm not well versed enough to know that though.

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.