arqex / react-datetime

A lightweight but complete datetime picker react component.
1.99k stars 873 forks source link

Prop displayTimeZone causes inability to type in date field #798

Open kfox112 opened 3 years ago

kfox112 commented 3 years ago

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

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.