Cleave.js: Raise Default Numeral Decimal Scale

Created on 15 Jul 2016  路  4Comments  路  Source: nosir/cleave.js

Currently the default numeral formatter only supports decimals to two digits beyond the decimal point. I think this could be improved on by raising the limit to perhaps 5 or 6. This seems to me a more reasonable default value for decimal places.

This default could be changed in line 364 of cleave.js (within the definition of DefaultProperties):
target.numeralDecimalScale = opts.numeralDecimalScale || 2;
to
target.numeralDecimalScale = opts.numeralDecimalScale || 6;

Most helpful comment

It's not wise to reject that propose. When implementing crypto currency, sometimes we need to provide more than 2 decimal digits number (e.x. a mount of Bitcoin to sell/buy). It's appreciated if you guys can fix this.

All 4 comments

The numeral mode is mainly designed for inputting currency/money value, so will keep it as 2.
Thanks for proposing.

It's not wise to reject that propose. When implementing crypto currency, sometimes we need to provide more than 2 decimal digits number (e.x. a mount of Bitcoin to sell/buy). It's appreciated if you guys can fix this.

@athongintel I understand the requirement to have more than 2 digits decimal number, but why would it be a problem for you to pass numeralDecimalScale as an option? like this https://github.com/nosir/cleave.js/blob/master/doc/options.md#numeraldecimalscale

Yes, I found it later on. Thank you very much.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

madastro picture madastro  路  7Comments

periabyte picture periabyte  路  7Comments

dan-kez picture dan-kez  路  5Comments

shaileshrathod128 picture shaileshrathod128  路  6Comments

mrozado picture mrozado  路  3Comments