Skip to content

digits ​

Checks that the value consists of ASCII digits 0-9 only. Unlike positive_integer, leading zeros are kept and the output is a string.

Error codes: NOT_DIGITS, FORMAT_ERROR

Live example · edit rules or inputOpen in playground
rules
input
Invaliderrors
{
  "otp": "NOT_DIGITS"
}

The string form of the value must be one or more digits: "007" gives "007", 7 gives "7".

js
{ zip: 'digits', otp: ['digits', { length_equal: 6 }] }