react-lightning-design-system icon indicating copy to clipboard operation
react-lightning-design-system copied to clipboard

DateInput and invalid values

Open miloandmilk opened this issue 5 years ago • 0 comments

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).

miloandmilk avatar Oct 04 '18 14:10 miloandmilk