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

[REQUEST] Documentation of min and max validators should mention behavior in case of non-number input #70

Open
omer-g opened this issue Feb 28, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@omer-g
Copy link
Contributor

omer-g commented Feb 28, 2022

Is your feature request related to a problem? Please describe.
Currently the documentation of min and max validators does not specify what is the behavior when a non-number value (NaN) is provided. Users may think these validators accept only numbers as valid input, but in case of a non-number the function validates its length.

Describe the solution you'd like
It would be helpful to have this explicitly stated in the documentation of min and max.

Additional context
On a side not, it might be nice to have a validator for "input is a number" (though one can get that with a pattern validator).

@omer-g omer-g added the enhancement New feature or request label Feb 28, 2022
@omer-g
Copy link
Contributor Author

omer-g commented Feb 28, 2022

On second thought, it could be useful to have an optional parameter that allows explicitly choosing if min should check length or numerical value. There are several cases where one would want to check for a length of a number (for example a zip code with at least 5 digits, an ID number etc.).

@chainlist
Copy link
Owner

Hi @omer-g,

Indeed the documentation doesn't specifically point out that in case of a non numeric value (here: string) the validators consider the length of the value.
I am going to add that asap.

Considering your comment, in a lot of cases ZIP code have to be (most of the time) considered as string and not numbers.
Almost every countries have their zip code regex validation online and can have non numerical characters in them.

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

No branches or pull requests

2 participants