lion/packages/localize/docs/amount-html.md
Thomas Allmer ec8da8f12c feat: release inital public lion version
Co-authored-by: Mikhail Bashkirov <mikhail.bashkirov@ing.com>
Co-authored-by: Thijs Louisse <thijs.louisse@ing.com>
Co-authored-by: Joren Broekema <joren.broekema@ing.com>
Co-authored-by: Gerjan van Geest <gerjan.van.geest@ing.com>
Co-authored-by: Erik Kroes <erik.kroes@ing.com>
Co-authored-by: Lars den Bakker <lars.den.bakker@ing.com>
2019-04-26 10:37:57 +02:00

30 lines
762 B
Markdown

# Amount
The amount formatter returns a number based on the locale by using [Intl NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) specification.
## Features
- **formatAmountHtml**: returns a formatted amount based on locale to be used in lit-html
- **formatAmountHtmlString**: returns a formatted amount based on locale as a string
## How to use
### Installation
```
npm i --save @lion/localize;
```
### Example
```js
import { formatAmountHtml } from '@lion/localize';
// inside your webcomponent
render () {
return html`
The current cart values is ${formatAmountHtml(1999.9)}.
`;
}
// output (depending on locale)
// The current cart values is EUR 1.999,<span style="">90</span>.
```