between
Validates that a numeric value is between a minimum and maximum.
Options
| Option | Type | Default | Description |
|---|---|---|---|
min | number | required | Minimum allowed value |
max | number | required | Maximum allowed value |
inclusive | boolean | true | If true, min and max themselves are valid |
message | string | locale default | Custom error message |
Playground
Valid values
| Value | Notes |
|---|---|
"18" | Equal to min (inclusive=true) |
"50" | Between min and max |
"99" | Equal to max (inclusive=true) |
Invalid values
| Value | Reason |
|---|---|
"17" | Below min |
"100" | Above max |
"18" | When inclusive: false |
"abc" | Not a number |
Notes
- Empty string (
"") always returnsvalid: true— validators only run on non-empty values. Combine withnotEmptyto require a value. inclusive: falsemeans min and max themselves are invalid.