min

Take the minimum of the filter value and its first argument.

Usage with two values

Take the maximum of the filter value and its first argument.

   {% print 102 | to_integer | max:103 %}

Prints 102.

Usage with two values

Take the minimum of the filter value and its first argument::

{{ 102 | min:103 }}

Prints 103.

Usage with lists

Find the minimum value in a list::


   {% print [1, 5, 3, 9, 2] | min %}

Prints 1.

Edge cases

  • undefined | min returns undefined
  • undefined | min:1000 returns undefined
  • [] | max (empty list) returns undefined
  • Works with translation tuple values.

Edit on GitHub

Referred by

Category

Filters

Template value transformations for text, collections, dates, numbers, URLs, and other data.