Skip to content

DateInput and invalid values #288

Open
@miloandmilk

Description

@miloandmilk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions