Skip to main content

Formatting values

Formatting helpers follow the same Angular-pipe style used by Handlebars. You can chain them to combine effects, for example:

{{leastDecimals (numberFormat cargo.tonnage 'F02')}}

Default locale is nl-NL unless noted otherwise.


Date

Formats a date value. The underlying call is C# DateTime.Format(format), so all .NET date format strings are supported. When no format is supplied the Dutch format (nl-NL) is used.

dateFormat format
ArgumentTypeDescription
formatstring.NET date format string. Defaults to dd-MM-yyyy HH:mm (nl-NL).

Example

{{dateFormat vessel.eta}}                      => 10-03-2024 14:00
{{dateFormat vessel.eta 'MM/dd/yyyy'}} => 03/10/2024

Time

Formats a time or datetime value. Defaults to HH:mm when no format is given.

timeFormat format
ArgumentTypeDescription
formatstring.NET time format string. Defaults to HH:mm.

Example

{{timeFormat vessel.eta}}                      => 14:00
{{timeFormat vessel.eta 'HH.mm.ss'}} => 14.00.00

Currency

Formats a numeric value as a currency string.

currencyFormat currencyCode display digitsInfo locale
ArgumentTypeDescription
currencyCodestringISO 4217 currency code, e.g. USD or EUR.
displaystringcode (default) shows USD; symbol shows $.
digitsInfostring{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}, e.g. 1.2-2.
localestringLocale for number formatting. Defaults to nl-NL.

Example

{{currencyFormat invoice.amount}}                                       => EUR 1.250,00
{{currencyFormat invoice.amount 'USD' 'symbol'}} => $ 1.250,00
{{currencyFormat invoice.amount 'USD' 'symbol' '1.2-2' 'en-US'}} => $ 1,250.00

Number

Formats a numeric value using a .NET format string. See the Microsoft documentation for all supported formats.

numberFormat format
ArgumentTypeDescription
formatstring.NET numeric format string, e.g. F02, G, N.

Example

{{numberFormat cargo.tonnage 'F01'}}    => 45000.5
{{numberFormat cargo.tonnage 'G'}} => 45000.5

Least amount of decimals

Removes unnecessary trailing zeros from a decimal number.

leastDecimals

Example

{{leastDecimals 45000}}      => 45000
{{leastDecimals 45000.50}} => 45000.5
{{leastDecimals 0.000}} => 0

Boolean

Replaces a boolean value with custom text. When no strings are provided the server's default .NET environment values are used.

booleanFormat trueString falseString
ArgumentTypeDescription
trueStringstringText to display for true.
falseStringstringText to display for false.

Example

{{booleanFormat vessel.isLoaded}}                  => True
{{booleanFormat vessel.isLoaded 'Loaded' 'Empty'}} => Loaded
{{booleanFormat false 'Loaded' 'Empty'}} => Empty

Country name

Converts a 2-letter ISO 3166-1 alpha-2 country code into a human-readable country name. If the code is not valid, the original value is returned unchanged.

countryName countryCode language
ArgumentTypeDescription
countryCodestringISO 3166-1 alpha-2 country code (e.g. NL, DE). Must be exactly 2 characters.
languagestringOptional: language for the output name. Defaults to en.

Example

{{countryName portCall.countryCode}}          => Netherlands
{{countryName portCall.countryCode 'nl'}} => Nederland
{{countryName 'DE' 'nl'}} => Duitsland
{{countryName 'XX'}} => XX

Lowercase

Converts all characters in a string to lowercase.

lowercase

Example

{{lowercase vessel.name}}    => ocean star

Uppercase

Converts all characters in a string to uppercase.

uppercase

Example

{{uppercase vessel.name}}    => OCEAN STAR