Browse the docs

ordinal

Writes a whole number as an ordinal: 1st, 2nd, 3rd.

Details #

ordinal(n, locale?) writes a whole number as an ordinal: 3 is 3rd, 11 is 11th, 22 is 22nd. It is also the ordinal op of Transform text.

Parameters #

Takes 1 to 2 arguments. {{ ordinal(text, b?) }}

Examples #

ordinal(3, "en_US")
→ 3rd
ordinal(2026 % 100, "en_US")
→ 26th

Gotchas #

  • A number with a fraction fails with ordinal() needs a whole number.