diff --git a/src/countUp.ts b/src/countUp.ts index d9b1d6c..4854091 100644 --- a/src/countUp.ts +++ b/src/countUp.ts @@ -225,7 +225,11 @@ export class CountUp { this.frameVal = wentPast ? this.endVal : this.frameVal; // decimal - this.frameVal = Number(this.frameVal.toFixed(this.options.decimalPlaces)); + if (this.options.decimalPlaces) { + this.frameVal = Number(this.frameVal.toFixed(this.options.decimalPlaces)); + } else { + this.frameVal = Number(parseInt(this.frameVal.toString())); + } // format and print value this.printValue(this.frameVal); @@ -284,7 +288,11 @@ export class CountUp { x1: string, x2: string, x3: string; - result = Math.abs(num).toFixed(this.options.decimalPlaces); + if (this.options.decimalPlaces) { + result = Math.abs(num).toFixed(this.options.decimalPlaces); + } else { + result = Math.abs(parseInt(num?.toString())).toString(); + } result += ''; const x = result.split('.'); x1 = x[0];