bignumber.js icon indicating copy to clipboard operation
bignumber.js copied to clipboard

Enhancement: Add support for custom minus sign in toFormat method

Open skynightz opened this issue 4 years ago • 5 comments

It would be great to be able to specify a string or a character to customize negative sign of a value. It's using the character "hypen minus" (decimal code: 45) in your code and we want to use the "minus sign" (decimal code: 8722) instead.

skynightz avatar Mar 30 '21 17:03 skynightz

ping.. please

Skywalker13 avatar May 06 '21 09:05 Skywalker13

It's reasonable but the changes to the behaviour of toString would break creating a BigNumber from a BigNumber's toString value, which is unacceptable.

MikeMcl avatar May 09 '21 12:05 MikeMcl

I modified also the toString method because it was used in toFormat for the "-Infinity" case. it wasn't formating the string in this case. I can modify my PR to change only the toFormat method.

skynightz avatar May 10 '21 10:05 skynightz

I reverted my changes in toString method and handle the case for negative infinity in toFormat method.

skynightz avatar May 10 '21 10:05 skynightz

Okay, I'll take a look presently.

MikeMcl avatar May 10 '21 22:05 MikeMcl