Skip to content

Commit

Permalink
docs: document accounting format
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkaradachki authored and gyoshev committed Jun 12, 2017
1 parent a3e34bf commit 0f3f4f4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/num-formatting/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Specifies the format style.
The supported values are:
* `"decimal"`
* `"currency"`
* `"accounting"`
* `"percent"`
* `"scientific"`

Expand Down
14 changes: 12 additions & 2 deletions docs/num-formatting/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@ Standard number formatting can be specified by passing an options object or a st

formatNumber(1234.5678, "c5", "bg"); // 1 234,56780 лв

* **The `"a"` specifier**—Same as `"c"` but uses the currency accounting format.

> The locale numbers `currencies` data and the supplemental `currencyData` must be loaded for the currency formatting to work.
import { formatNumber } from '@telerik/kendo-intl';

formatNumber(-1234.5678, "a"); // ($1,234.57)

formatNumber(1234.5678, "a3", "de-CH"); // 1’234.568 CHF

* **The `"p"` specifier**—Formats the number as a percentage based on the locale. The passed number is multiplied by 100. To specify precision, add a number after `"p"`. By default, the number is formatted and rounded to zero decimal digits.

import { formatNumber } from '@telerik/kendo-intl';
Expand All @@ -69,7 +79,7 @@ Standard number formatting can be specified by passing an options object or a st
}); // 1,234.5678

formatNumber(1234.5678, {
style: "currency",
style: "currency",
currency: "EUR",
currencyDisplay: "displayName"
}, "bg"); // 1 234,57 евро
Expand All @@ -90,7 +100,7 @@ The supported format specifiers are:

import { formatNumber } from '@telerik/kendo-intl';

formatNumber(1234.5678, "00000"); // 01235
formatNumber(1234.5678, "00000"); // 01235

* **The `"#"` specifier**—A digit placeholder. It replaces the Pound sign with the corresponding digit if one is present. Otherwise, no digit appears in the result string.

Expand Down
2 changes: 1 addition & 1 deletion src/numbers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface NumberFormatOptions {
/**
* Specifies the format style.
*/
style?: 'decimal' | 'currency' | 'percent' | 'scientific';
style?: 'decimal' | 'currency' | 'percent' | 'scientific' | 'accounting';

/**
* Defines the currency code of the currency that is used in the formatting.
Expand Down

0 comments on commit 0f3f4f4

Please sign in to comment.