react-datetime icon indicating copy to clipboard operation
react-datetime copied to clipboard

Prop displayTimeZone causes inability to type in date field

Open kfox112 opened this issue 4 years ago • 0 comments

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.

kfox112 avatar Jul 18 '21 18:07 kfox112