Yup: Yup.number().max() doesn't work

Created on 10 Apr 2019  路  2Comments  路  Source: jquense/yup

I'm trying to validate a field with yup.number( ).max(5) and doesn't work. The field only allows you to type 1 character, after the second one starting showing error.

How to reproduce this problem:

  1. Use this sandbox: https://codesandbox.io/embed/r5jwp47v7m
  2. Type 123456
  3. It will show Too Long! after the second character.

Most helpful comment

max isn't the number of digits, its the size of the number, so 12 > 5

All 2 comments

max isn't the number of digits, its the size of the number, so 12 > 5

Ohhh! but for string( ) method it works like a length validation, right?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

the-daniel-rothig picture the-daniel-rothig  路  4Comments

jakke-korpelainen picture jakke-korpelainen  路  4Comments

jgcmarins picture jgcmarins  路  4Comments

laurazenc picture laurazenc  路  3Comments

haddyo picture haddyo  路  3Comments