Browse Source

fix(nc-gui): implement display of decimal values with trailing zeros using toFixed() (#9464)

pull/9462/head
Ramesh Mane 3 months ago committed by GitHub
parent
commit
9a0b34eab8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 4
      packages/nocodb-sdk/src/lib/helperFunctions.ts

4
packages/nocodb-sdk/src/lib/helperFunctions.ts

@ -186,9 +186,9 @@ function roundUpToPrecision(number: number, precision: number = 0) {
let pair = `${number}e`.split('e'); let pair = `${number}e`.split('e');
const value = Math.round(Number(`${pair[0]}e${+pair[1] + precision}`)); const value = Math.round(Number(`${pair[0]}e${+pair[1] + precision}`));
pair = `${value}e`.split('e'); pair = `${value}e`.split('e');
return +`${pair[0]}e${+pair[1] - precision}`; return (+`${pair[0]}e${+pair[1] - precision}`).toFixed(precision);
} }
return Math.round(number); return Math.round(number).toFixed(precision);
} }
export { export {

Loading…
Cancel
Save