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
| Format | Input | Output |
|---|---|---|
$0,0 | 146000 | $146,000 |
0,0 | 50000 | 50,000 |
0.0% | 0.065 | 6.5% |
0[.]0 | 1.23 | 1.2 |
$0,0.00 | 1234.5 | $1,234.50 |
0o | 3 | 3rd |
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.5with the format0.0n/dwould result in1½. 1.2345formatted as0[.]00n/dyields1.23.
The Numeral number format is what precedes n/d in the format string.
Numbers onlyDo 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
| Format | Input | Output |
|---|---|---|
MM/dd/yyyy | 2026-04-15 | 04/15/2026 |
MMMM d, yyyy | 2026-04-15 | April 15, 2026 |
yyyy | 2026-04-15 | 2026 |
Updated 5 days ago
