Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually think the line need to be this...
if you try your with
keepInvalid
it works but if you removekeepInvalid
its allowing invalid charactersThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The difference between keepInvalid true and false should only be on onBlur.
You can input invalid characters with it true and false, but, when onBlur state value remains on keepInvalid = true, and on keepInvalid = false makes the state value null. (please test the old version too (8.7.1)
I'm trying to upgrade from 6.6 and it worked as i said, now is broken.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description of keepInvalid from docs:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just try your fix above with both
keepInvalid={true}
andkeepInvalid={false}
you will see your fix does NOT work. Then try mine you will see it does work.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a couple of digging and found out why it didn't update. updateInputField didn't work properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change of:
formattedValue = isValidDate(value) ? formatDateTime(value) : '';
To
formattedValue = isValidDate(value) ? formatDateTime(value) : props.keepInvalid ? 'value' : ''
Is also a possibility