...
date
must be a valid input for moment(). When using timestamps it must be in milliseconds.format
must be a valid moment.format() string.
Example
Template:
Code Block |
---|
|
{{date data.time}} |
...
Code Block |
---|
|
02.04.2020 10:33:29 |
duration
Format given duration.
{{duration <duration> [format]}}
duration
must be a valid input for moment.duration(). When using timestamps it must be in milliseconds.format
must be a valid moment.format() string.
Example
Code Block |
---|
|
{{duration duration}} |
Code Block |
---|
|
{
"data": {
"duration": 10000
}
} |
durationHumanize
Format a given duration in a human readable format.
{{durationHumanize <duration>}}
duration
must be a valid input for moment.duration(). When using timestamps it must be in milliseconds.
Example
Code Block |
---|
|
{{durationHumanize data.duration}} |
Code Block |
---|
|
{
"data": {
"duration": 10000
}
} |
durationAs
Get a given duration in a certain unit of time.
{{durationAs <duration> [unit_of_time]}}
duration
must be a valid input for moment.duration(). When using timestamps it must be in milliseconds.unit_of_time
must be a valid input for moment.duration().as()
Example
Code Block |
---|
|
{{durationAs data.duration "milliseconds"}} |
Code Block |
---|
|
{
"data": {
"duration": 10000
}
} |
fromNow
Display the time between now and a given time. See also: moment().fromNow().
{{fromNow <date>}}
date
must be a valid input for moment(). When using timestamps it must be in milliseconds.
Example
Code Block |
---|
|
{{fromNow data.time}} |
Code Block |
---|
|
{
"data": {
"time": 1585823609000
}
} |
typeof
Display the js type of a value. Useful for debugging.
{{typeof <value>}}
date
must be a valid input for moment(). When using timestamps it must be in milliseconds.
Example
Code Block |
---|
|
{{typeof data.value}} |
Code Block |
---|
|
{
"data": {
"value": 1337
}
} |
toFixed (number of decimals)
Display a number with given amount of decimal places. For more advanced formatting see numberFormat
.
{{toFixed <value> [decimals]}}
decimals
number of decimal places (Default: 2)
Example
Code Block |
---|
|
{{toFixed data.value 3}} |
Code Block |
---|
|
{
"data": {
"value": 1.2345
}
} |
numberFormat
Format a number.
{{numberFormat <value> [options]}}
options:
thousandsSep
separator between 3 digits (Default: locale dependent)decimalSep
decimal separator (Default: locale dependent)decimals
number of decimal places (Default: 2)
Example
Code Block |
---|
|
{
"data": {
"value": 1024.2345
}
} |
Math: ceil, floor, div, max
Mathematical operations.
{{ceil <value>}}
round up to integer{{floor <value>}}
round down to integer{{div <nom> <denom>}}
returns nom / denom{{max <list> [property_path]}}
returns the biggest element from the list. Compares the given property_path
.
Boolean operations
Boolean operations, useful for #if
conditions.
{{not <value>}}
negate the value{{eq <v1> <v2>}}
v1 == v2{{lt <v1> <v2>}}
v1 < v2{{lte <v1> <v2>}}
v1 <= v2{{gt <v1> <v2>}}
v1 > v2{{gte <v1> <v2>}}
v1 >= v2
icon
Render an Icon
{{icon <name> [category]}}
name
name of the icon. Find all icons here: SLDS Iconscategory
category of the icon (Default: "utility").