Commit d5dda9ce authored by Floréal Cabanettes's avatar Floréal Cabanettes

Fix float precision for small numbers

parent ab02bcd1
...@@ -214,7 +214,8 @@ trackmybank.getStringAmount = function(amount) { ...@@ -214,7 +214,8 @@ trackmybank.getStringAmount = function(amount) {
comma = number.length; comma = number.length;
} }
} }
return parseFloat(number).toPrecision(comma + (comma >= 2 ? 2 : 1)); let floatNumber = parseFloat(number);
return floatNumber.toPrecision(comma + (floatNumber >= 1 ? 2 : ((floatNumber < 0 && floatNumber > -1) ? 0 : 1)));
}; };
trackmybank.getTotal = function(nbSubTr) { trackmybank.getTotal = function(nbSubTr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment