lion/packages/localize/docs/amount-html.md
2019-07-24 15:20:19 +02:00

765 B

Amount

The amount formatter returns a number based on the locale by using Intl 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

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>.