close #731 Fixed: Precision on currency error
This commit is contained in:
parent
812ffeea9b
commit
39d3c85615
16
public/js/jquery/jquery.maskMoney.js
vendored
16
public/js/jquery/jquery.maskMoney.js
vendored
@ -616,9 +616,15 @@
|
|||||||
function maskValueStandard(value, settings) {
|
function maskValueStandard(value, settings) {
|
||||||
var negative = (value.indexOf("-") > -1 && settings.allowNegative) ? "-" : "",
|
var negative = (value.indexOf("-") > -1 && settings.allowNegative) ? "-" : "",
|
||||||
onlyNumbers = value.replace(/[^0-9]/g, ""),
|
onlyNumbers = value.replace(/[^0-9]/g, ""),
|
||||||
valueWithoutSymbol = value.replace(settings.prefix, "").replace(settings.suffix, ""),
|
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),
|
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,
|
newValue,
|
||||||
decimalPart,
|
decimalPart,
|
||||||
leadingZeros;
|
leadingZeros;
|
||||||
@ -626,6 +632,10 @@
|
|||||||
if (settings.suffix != '' && value.length != valueWithoutSymbol.length) {
|
if (settings.suffix != '' && value.length != valueWithoutSymbol.length) {
|
||||||
input_precision = valueWithoutSymbol.length - valueWithoutSymbol.lastIndexOf(settings.decimal) - 1;
|
input_precision = valueWithoutSymbol.length - valueWithoutSymbol.lastIndexOf(settings.decimal) - 1;
|
||||||
|
|
||||||
|
if (settings.precision == 0) {
|
||||||
|
input_precision = 0;
|
||||||
|
}
|
||||||
|
|
||||||
integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision);
|
integerPart = onlyNumbers.slice(0, onlyNumbers.length - input_precision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user