1

Using the JQuery globalization plugin, I want to format numbers to use as many decimals needed to represent the correct value. Also i want the format to use as few decimals as possible.

For example the following example yields '56.12'

Globalize.culture('en');
console.log( Globalize.format(56,123456, 'N') );

i want it to yield 56.123456

Am i missing some kind of format option or other alternative?

Examples of what i want:

  • 1.12 -> '1.12'
  • 1.123 -> '1.123'
  • 1 -> '1'

Link to library: https://github.com/jquery/globalize/

Yodiz
  • 258
  • 2
  • 12

0 Answers0