Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateInput and invalid values #288

Open
miloandmilk opened this issue Oct 4, 2018 · 0 comments
Open

DateInput and invalid values #288

miloandmilk opened this issue Oct 4, 2018 · 0 comments

Comments

@miloandmilk
Copy link

When a value such as 12/01/20aa is entered, setValueFromInput is called and the input value is passed to moment which will create a date. This can leave a date input with a irrelevant date based off garbage input.

I have modified setValueFromInput locally to include the following:

if(!!this.props.error) {
return;
}

which prevents an invalid date being set on invalid input - this only kicks in if an error is supplied to the component.

If this behavior makes sense to you, it would be great if something like the above could be addedn (or a valdation function passed in as a prop to check for invalid input).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant