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>
<br/>
<lightning-formatted-number value="123.456" maximum-fraction-digits="3" maximum-significant-digits="5">
</lightning-formatted-number>
It displays as:
123.456
123.46
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?
12345678.456
=>12345678
even if min fraction digits are mentioned as 3.123.456
has 6 significant digits. Settingmaximum-significant-digits
to 5 correctly shows the number as123.46
but but settingmaximum-fraction-digits
to 2 should, I think, show as123.46
but actually shows as123.456