Skip to content
Shapemetry

Model - Format functions

Every function callable as Format.* inside an expression — an argument input, a parameter binding, a table cell. Pure: no side effects, no async.

FunctionReturnsDescriptionArgTypeMeaning
Format.currency(value, code, locale)stringLocale currency display via Intl.NumberFormat, e.g. "$1,200.00".valuenumberthe amount
codestringISO 4217 currency code, default 'USD'
localestringBCP 47 locale tag; omit for the runtime default
Format.date(value, locale, style)stringLocale date display via Intl.DateTimeFormat.valuestring | numberISO date string or epoch ms — never "now" (time is host-injected state, keeps documents deterministic)
localestringBCP 47 locale tag; omit for the runtime default
stylestringIntl.DateTimeFormat dateStyle: 'full' | 'long' | 'medium' | 'short', default 'medium'
Format.number(value, decimals, locale)stringGrouped number display via Intl.NumberFormat, e.g. "1,234.50".valuenumberthe number
decimalsnumberfixed decimal places; omit for locale default
localestringBCP 47 locale tag; omit for the runtime default
Format.percent(value, decimals, locale)stringPercent display via Intl.NumberFormat, e.g. "42%" — value is the 0..1 fraction, not the already-scaled number.valuenumber0..1 fraction
decimalsnumberdecimal places, default 0
localestringBCP 47 locale tag; omit for the runtime default
Last updated: 📖 1 min readEdit on GitHub