Skip to content

Commit

Permalink
#307: correctly format decimal with leading zeroes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas committed Aug 22, 2023
1 parent cab5bca commit 5c1ba6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions viewer/util/formatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ const formatDecimal=function(number,fix,fract,addSpace,prefixZero){
number=-number;
sign="-";
}
let rt=sign+number.toFixed(fract);
let rt=(prefixZero?"":sign)+number.toFixed(fract);
let v=10;
fix-=1;
while (fix > 0){
Expand All @@ -96,7 +96,7 @@ const formatDecimal=function(number,fix,fract,addSpace,prefixZero){
v=v*10;
fix-=1;
}
return rt;
return prefixZero?(sign+rt):rt;
};
formatDecimal.parameters=[
{name:'fix',type:'NUMBER'},
Expand Down

0 comments on commit 5c1ba6c

Please sign in to comment.