Formatting

Format variables the way you want them to look

Number

To format numbers, use the $number format function:

Variable Name: the name of your variable that will contain the value to be formatted. Format String: the text code that tells Documint how to would like to format the value

General

$number

Used for applying custom formatting to numbers.

Signature

{{$number value format_string [locale]}}

Arguments

Returns

Formatted number

Example #1 - Basic

// given qty_sold is 1250
{{$number qty_sold "0,0"}} // 1,250

Example #2 - With Default

// given qty_sold is blank
{{$number qty_sold "0,0" default="0"}} // 0

Standard

Currency

Example:

// given grand_total is 1800
{{$number grand_total "$0,0.00"}} // $1,800.00

Percentage

Duration

Source: numeral.js

Date/Time

To format dates, use the $date format function:

Example

// given invoice_date is "2021-05-18T20:05:07Z"
{{$date invoice_date "MM/DD/YYYY h:mm a"}} // 05/18/2021 8:05 pm

Standard

Source: moment.js

Current Date/Time

To add the current date/time use the Date formatter with the format property set.

Example

{{$date "MM/DD/YYYY"}}

Last updated