close #731 Fixed: Precision on currency error

This commit is contained in:
cuneytsenturk 2019-01-25 14:41:29 +03:00
parent 812ffeea9b
commit 39d3c85615

View File

@ -616,9 +616,15 @@
function maskValueStandard(value, settings) {
var negative = (value.indexOf("-") > -1 && settings.allowNegative) ? "-" : "",
onlyNumbers = value.replace(/[^0-9]/g, ""),
valueWithoutSymbol = value.replace(settings.prefix, "").replace(settings.suffix, ""),
input_precision = value.length - value.lastIndexOf(settings.decimal) - 1,
integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision),
valueWithoutSymbol = value.replace(settings.prefix, "").replace(settings.suffix, "");
var input_precision = value.length - value.lastIndexOf(settings.decimal) - 1;
if (settings.precision == 0) {
input_precision = 0;
}
var integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision),
newValue,
decimalPart,
leadingZeros;
@ -626,6 +632,10 @@
if (settings.suffix != '' && value.length != valueWithoutSymbol.length) {
input_precision = valueWithoutSymbol.length - valueWithoutSymbol.lastIndexOf(settings.decimal) - 1;
if (settings.precision == 0) {
input_precision = 0;
}
integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision);
}