Skip to content

NumberRangeFilter

Records with a number between a minimum and a maximum; both bounds are optional and inclusive. Users type numbers in the format of their locale.

use Anvil\Collection\Filters\NumberRangeFilter;
NumberRangeFilter::make('amount'),
NumberRangeFilter::make('quantity')->decimals(0),
Option Effect Default
decimals(n) the most decimals the inputs accept 2

Plus label() and column().

Two inputs “min” and “max”. They accept the format of the locale with or without grouping (1.234,5 or 1234,5 in German); more decimals than configured are rejected (422).

column >= min, column <= max, with the normalised number (1234.5).

Saved normalised with a point (['min' => '1000', 'max' => '5000.50']) and shown in the locale of the user who applies the view, so a view works for users with other languages. API: filter[amount][min]=1000&filter[amount][max]=5000.50 (point as decimal separator, no grouping).