You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I needed a validation rule that accepts only positive numbers. I saw that the library comes with a validationrule called "IsPositive", great!
Unfortunately when testing it it accepted the value 0, and when I checked the source it validates like: value >= 0.
The number 0 is neither negative or positive.
A rule accepting 0 and all positive numbers should be called isNonNegative, while isPositive should only accept values that are greater than 0.
Same goes for isNegative vs isNonPositive.
Changing this would obviously be a breaking change, however I believe this is very confusing and incorrect. Maybe some documentation should be created where this is mentioned, on top of an addition to the library with a rule isPositiveZeroExcluded or something.
Obviously it is easy to just create this as a custom rule
The text was updated successfully, but these errors were encountered:
I needed a validation rule that accepts only positive numbers. I saw that the library comes with a validationrule called "IsPositive", great!
Unfortunately when testing it it accepted the value 0, and when I checked the source it validates like:
value >= 0
.The number 0 is neither negative or positive.
A rule accepting 0 and all positive numbers should be called
isNonNegative
, whileisPositive
should only accept values that are greater than 0.Same goes for
isNegative
vsisNonPositive
.Changing this would obviously be a breaking change, however I believe this is very confusing and incorrect. Maybe some documentation should be created where this is mentioned, on top of an addition to the library with a rule
isPositiveZeroExcluded
or something.Obviously it is easy to just create this as a custom rule
The text was updated successfully, but these errors were encountered: