Digits Only
Strip everything except digits
Digits Only
The digitsOnly formatter removes every character that is not a digit.
Usage
validationSchema: {
otp: { format: "digitsOnly" },
}Result
| Input | Result |
|---|---|
12a34-bc56 | 123456 |
Things to know
- The equivalent
normalize: "digits"preset runs on change with the same effect.