intvalues on the dash -, casts each piece to an integer, sorts them ascending, then collapses every run of consecutive integers into a from-to span. Single values are printed alone; the spans and singles are joined with , (comma and space). So 1-4-5-6 becomes 1, 4-6 and 2008-2009-2010-2011 becomes 2008-2011.5-1-2-4-3 still yields 1-5.2020-2020-2021-2022 gives 2020, 2020-2022. A literal 0 is dropped (the splitter discards empty and zero-like pieces), and any non-numeric piece counts as 0 and is likewise dropped. Empty input produces empty output.intvalues is a multi-value field flattened with the {@field:-} getter, for example {range:{@year............:-}}, which turns the years stored on an item into a tidy span.intvalues requiredThe dash-separated list of integers to collapse. Each piece is cast to an integer, the whole list is sorted ascending, then consecutive integers are merged into from-to spans. Order is not significant; duplicates are kept (a repeat breaks a run); empty and zero-valued pieces are dropped. Commonly fed from a multi-value field via the field getter, e.g. the years on an item.
{range:1-2-3-4}
{range:1-4-5-6}
{range:2008-2009-2010-2011}
{range:5-1-2-4-3}
{range:1-2-3-5-7-8-9}
{range:{@year............:-}}