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

isRequired validation doesn't allow "falsy" values #41

Closed
petr-egert opened this issue Feb 27, 2020 · 0 comments · Fixed by #63
Closed

isRequired validation doesn't allow "falsy" values #41

petr-egert opened this issue Feb 27, 2020 · 0 comments · Fixed by #63

Comments

@petr-egert
Copy link

The documentation for isRequired states

Checks if the value is present

The current implementation however does not only check if the value is present, but also checks if the value is truthy

export default ifElse(isTruthy, alwaysNull, always({ message: m.isRequired }));

This is confusing, because valid values, such as 0, are resolved as invalid. I think 0 is a perfectly reasonable value for a "required" numerical input or select box. The same applies to boolean values - the validation should force the user to "make a choice", not to "pick true"

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

Successfully merging a pull request may close this issue.

1 participant