question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need more numbers after coma

See original GitHub issue

Hi!

Price rounds to 2 decimal places after comma, how to fix it? need 6 0.016257 => 0.02 need => 0.016257

333

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
rgitarovcommented, Apr 10, 2021

just made it work as follow:

priceFormat: {
    type: 'custom',
    minMove: '0.000001',
    formatter: (price) => {
        if (price < 0.000001) return parseFloat(price).toPrecision(8)
        else if (price >= 0.000001 && price < 1) return parseFloat(price).toPrecision(6)
        else return parseFloat(price).toPrecision(6)
    }
}, 
priceScale: {
    autoScale: true
},
localization: {
    locale: 'en-US',
    priceFormatter: (price) => {
    if (price < 0.000001) return parseFloat(price).toPrecision(8)
    else if (price >= 0.000001 && price < 1) return parseFloat(price).toPrecision(6)
    else return parseFloat(price).toPrecision(6)
    }
},

image

1reaction
timocovcommented, Sep 17, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Place Values After the Decimal Point
In some places around the world, a comma (,) is used to show where the decimal point is in a number. In other...
Read more >
When should I use a comma to separate numbers?
When should I use a comma to separate numbers? In English, we use commas to separate numbers greater than 999. We use a...
Read more >
Commas and Periods (Full Stops) in Numbers (UK/US)
In the US, UK, and China, a comma is placed every 3 digit positions for numbers larger than 999. The decimal point is...
Read more >
Rounding numbers to 2 digits after comma - javascript
Multiple with 100 and then do round to keep precision of 2 digits after comma; Divide back into 100 and use toFixed(2) to...
Read more >
Round a number to the decimal places I want
Select the cells that you want to format. On the Home tab, click Increase Decimal or Decrease Decimal to show more or fewer...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found