Formats

Any Variable can be formatted for textual display.

The variables[].format property specifies how a value should be displayed to users. The Taffrail API automatically applies formatting in a separate valueFormatted field. Formats commonly apply to Number, Percent, and Date Variables.

{
  "format": "0[.]0",
  "value": 1.23,
  "valueFormatted": "1.2"
}

For more detail, go to Variables: Format.

Numbers

Number formatting is based on Numeral.js.

Common Format Strings

FormatInputOutput
$0,0146000$146,000
0,05000050,000
0.0%0.0656.5%
0[.]01.231.2
$0,0.001234.5$1,234.50
0o33rd

Custom Formats

An additional Taffrail-custom format supports converting regular fractions to their Unicode equivalent. For example, 1/2 becomes ½.

The Unicode fraction format (n/d) can be used in combination with Numeral number formats, like this:

  • Formatting 1.5 with the format0.0n/d would result in .
  • 1.2345 formatted as 0[.]00n/d yields 1.23.

The Numeral number format is what precedes n/d in the format string.

🚧

Numbers only

Do not attempt to format Abbreviations, Ordinals, Percentages, or Currencies with this format string, they are not supported.

Dates

Date formatting is based on date-fns format.

Common Date Formats

FormatInputOutput
MM/dd/yyyy2026-04-1504/15/2026
MMMM d, yyyy2026-04-15April 15, 2026
yyyy2026-04-152026