I suspect a bug in the lightning-formatted-number Lightning Web Component. Can anyone confirm, or have I misunderstood?

I have this in a LWC:

<lightning-formatted-number value="123.456" maximum-fraction-digits="2" maximum-significant-digits="8">
<lightning-formatted-number value="123.456" maximum-fraction-digits="3" maximum-significant-digits="5">

It displays as:


I would have expected the first number so be displayed is 123.46 because of maximum-fraction-digits="2" but, as you see, all 3 decimal places are shown. (Assuming 'fraction digits' is some strange Salesforcey way of saying 'decimal places')

The 2nd number displays as I would expect, because maximum-significant-digits="5"

So, it seems to me that maximum-fraction-digits does not work, but maximum-significant-digits does. Am I right in believing this to be a bug & if so, how can I work around?

  • There is a difference between fraction digits and significant digits according to maths. If you want to fix the number of digits with trailing zeros then use the min fraction digits. or if you want to fix the number of fraction digits with rounding then use max fraction digits. Significant digits consider numbers before decimal point as well whereas fraction considers only after decimal point. Commented Aug 30, 2021 at 14:55
  • @RahulGawale yes, I understand. However, for the first number, maximum-fraction-digits=2 yet the number still displays 3 d.p. That is the problem.
    – NickJ
    Commented Aug 30, 2021 at 15:16
  • I think you need to use either of them as significant digit property overwrites the fraction digits. because significant digits also consider the numbers before the decimal point, for example, -> if you mention a significant digit as 8 then fraction digits will not show when the total number of digits to left of the decimal point is greater or equal to 8, so 12345678.456 => 12345678 even if min fraction digits are mentioned as 3. Commented Aug 30, 2021 at 15:30
  • @RahulGawale again, I understand, but in my example, 123.456 has 6 significant digits. Setting maximum-significant-digits to 5 correctly shows the number as 123.46 but but setting maximum-fraction-digits to 2 should, I think, show as 123.46 but actually shows as 123.456
    – NickJ
    Commented Aug 30, 2021 at 15:36

1 Answer 1


The behaviour is as you describe it, maximum-significant-digits overwrites maximum-fraction-digits. This is expected, according to Intl.NumberFormat specification.

See this question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .