DecimalPipe in angular cut the string if its more than 10 digits

38 Views Asked by At

I use decimal pipe to format the number in input field

value| number:'0.0-6': 'en-us'

When I use number with more than 10 digits shows this:

on 11111111111.123456 returns 11,111,111,111.123455

on 111111111111.123456 returns 111,111,111,111.12345

on 1111111111111.123456 returns 1,111,111,111,111.1234

on 11111111111111.123456 returns 11,111,111,111,111.123

It does not matter width of the input field.

Does anyone had the same issue? Is there any workaround?

I also try with 11999999999999.999999 and it shows 12,000,000,000,000

2

There are 2 best solutions below

0
Volodymyr Usarskyy On

DecimalPipe can render maximum 22 chars. This value was hardcoded and can't be changed.

0
Afif Alfiano On

You can create a custom pipe with your custom logic.