Number Helper

Helper Description
number2locale Returns the language-sensitive representation of a number as a string.

number2locale

Returns the language-sensitive representation of a number as a string.
Parameters:
  • val: number|string
    Target number or numeric string.
  • locales: string|undefined
    A string with a BCP 47 language tag, or an array of such strings.
    Corresponds to the locales parameter of the Intl.NumberFormat() constructor.
    In implementations without Intl.NumberFormat support, this parameter is ignored and the host's locale is usually used.
          // results in: 123,456.789
hbs.compile("{{number2locale val}}")({val: 123456.789});

// German uses comma as decimal separator and period for thousands.
// results in: 123.456,789
hbs.compile("{{number2locale val 'de-DE'}}")({val: 123456.789});