Skip to content

Latest commit

 

History

History
69 lines (51 loc) · 1.9 KB

NumberFormatFilter.md

File metadata and controls

69 lines (51 loc) · 1.9 KB
layout title
doc
NumberFormatFilter

NumberFormatFilter

The NumberFormat filter provides formatting of a number based on the ECMA-402 Internationalization API as implemented by ibm-js/ecma402.

Table of Contents

formatOptions

By supplying options you control how a number is formatted. Options are defined as per the ECMA-402 DateFormat API


For details on the specific options available from the ECMA-402 standard NumberFormat API , see Mozilla Developer Network: Intl.NumberFormat



Filter usage

The `a9n_numberFormat` filter provides the means to format a javascript number correctly for a specific locale. Honoring that locales language and formatting style.

Formatting options are derived either from the default application values or supplied on the individual command.

Typical use case is to use the filter inside a span tag as in the following examples.

This example shows using the application default values for formatting a variable `amount`

```html ```

produces a result, *assuming the default application values were not modified*, such as:

```html 2,560.235 ``` ---

This example shows using a specific locale to format the output of the variable `amount` in German format.

```html ```

produces a result such as:

```html 2.560,235 ```

This example shows using a custom options argument which specifies a limit on the number of decimal places.

```html ```

produces a result such as:

```html 2,560.23 ```