react-time-picker icon indicating copy to clipboard operation
react-time-picker copied to clipboard

Fix edge cases where the number 0 is passed to an input

Open johnhyde opened this issue 3 years ago • 2 comments

This fixes this issue: https://github.com/wojtekmaj/react-datetime-picker/issues/147 As well as an issue with showing leading zeroes.

Both issues stem from the fact that sometimes the value of the input element is the number 0 rather than the string "0", and since the number 0 is falsey, this value is interpreted as the input being empty when it's not.

johnhyde avatar Apr 23 '21 22:04 johnhyde

I've just been looking at a project that uses this library and was amazed to see if I added 00 for the minutes or seconds it ends up as "000"

This looks like maybe you're touching that area of code, would this pull request fix that?

Repro case: just go to the demo and type 00

Chrome v90 & Ubuntu 20.04

stevenkissack avatar May 27 '21 23:05 stevenkissack

@stevokk

This looks like maybe you're touching that area of code, would this pull request fix that?

Yes, it does, if I remember correctly. I'm hoping @wojtekmaj can find time to review this at some point, but if you don't want to wait for that you can always do what I did and fork react-datetime-picker, require my fork of react-time-picker, unignore the dist directory, build the library, and use it in your project with a GitHub url.

johnhyde avatar May 28 '21 07:05 johnhyde