Which dependency is removing comma zero values and how to stop it?



  • Hello,

    I have an item with a value of "300.00". I'd like jsreport to display the full value with the ".00" but some dependency or setting is omitting it and only displaying "300" instead.

    Playground example:

    https://playground.jsreport.net/w/anon/uD5yZQXV

    Thanks


  • administrators

    hi! your value is not changing because of some dependency or some setting being applied, your value changes from 300.00 to 300 because that is how JSON works, it omits the .00 for values that don't have meaningful decimal points when it is being parsed into a javascript object.

    0_1675869716658_Screenshot 2023-02-08 at 10.21.08@2x.jpg

    If you want to ensure a format or specific decimal points for your numbers you can use any of these options:

    • Number.toFixed(2)
    • Intl.NumberFormat
    • any javascript library that helps you format numbers in specific format

    here is updated playground example that uses Number.toFixed(2)


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.