Date & Number Formatting
Format dates, numbers, and currencies with localized formats and custom patterns.
Overview
When you pass raw data like 2026-02-08 or 4250.00 to a template, you probably want it displayed as "February 8, 2026" or "$4,250.00". Document Stack includes built-in formatters for dates, numbers, and currencies.
Date Formatting
Pass dates as ISO 8601 strings in your API data. Then set the display format on the field element in the inspector.
Built-in Date Formats
| Format | Example Output |
|---|---|
| Short | 02/08/2026 |
| Medium | Feb 8, 2026 |
| Long | February 8, 2026 |
| Full | Sunday, February 8, 2026 |
| ISO | 2026-02-08 |
| Relative | 3 days ago |
Custom Date Patterns
text
DD/MM/YYYY → 08/02/2026
MM-DD-YYYY → 02-08-2026
YYYY-MM-DD → 2026-02-08
MMM DD, YYYY → Feb 08, 2026
MMMM DD, YYYY → February 08, 2026
DD MMMM YYYY → 08 February 2026Date Input Format
Always send dates as ISO 8601 strings (YYYY-MM-DD orYYYY-MM-DDTHH:mm:ssZ) in your API data. The display format is applied by the template.Number Formatting
Format numbers with thousands separators, decimal places, and custom prefixes or suffixes.
Built-in Number Formats
| Format | Input | Output |
|---|---|---|
| Integer | 1234.56 | 1,235 |
| Decimal (2) | 1234.5 | 1,234.50 |
| Decimal (4) | 0.12345 | 0.1235 |
| Percentage | 0.125 | 12.5% |
| Compact | 1500000 | 1.5M |
Currency Formatting
Currency formatting adds the appropriate symbol, thousands separator, and decimal places based on the currency code:
| Currency | Input | Output |
|---|---|---|
| USD | 4250 | $4,250.00 |
| EUR | 4250 | €4.250,00 |
| GBP | 4250 | £4,250.00 |
| JPY | 4250 | ¥4,250 |
| INR | 4250 | ₹4,250.00 |
Setting Currency Format
- Select the field element
- In the inspector, set Format to Currency
- Choose the currency code (USD, EUR, GBP, etc.)
- Pass raw numeric values in your API data — the template handles formatting
JSON
{
"data": {
"subtotal": 4250,
"tax": 361.25,
"total": 4611.25
}
}Pass numbers as raw numeric values (not pre-formatted strings) so the template can apply consistent formatting. Sending
4250 is better than "$4,250.00".Locale Settings
Date and number formats adapt to the locale you set on the template:
- en-US — February 8, 2026 / $4,250.00 / 1,234.56
- en-GB — 8 February 2026 / £4,250.00 / 1,234.56
- de-DE — 8. Februar 2026 / 4.250,00 € / 1.234,56
- fr-FR — 8 février 2026 / 4 250,00 € / 1 234,56
- ja-JP — 2026年2月8日 / ¥4,250 / 1,234.56
Next Steps
- Calculated Fields — Compute values in templates
- Localization & i18n — Multi-language templates
- Data Binding — Dynamic data fundamentals