fix(display): use comma thousands separator for western number formatting
Changes 10 012 337.37 → 10,012,337.37 throughout the explorer. Co-Authored-By: Charon <charon@lethean.io>
This commit is contained in:
parent
1299633a41
commit
a67c2751c0
1 changed files with 2 additions and 2 deletions
|
|
@ -25,7 +25,7 @@ class Utils {
|
|||
const parsedNumber = typeof number === "number" ? number : parseFloat(number) || 0;
|
||||
const roundedNumber = parsedNumber.toFixed(decimalPlaces);
|
||||
const [integerPart, decimalPart] = roundedNumber.split(".");
|
||||
const formattedIntegerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, " ");
|
||||
const formattedIntegerPart = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
const formattedNumber = formattedIntegerPart + (decimalPlaces > 0 ? "." + decimalPart : "");
|
||||
return formattedNumber;
|
||||
}
|
||||
|
|
@ -59,7 +59,7 @@ class Utils {
|
|||
const integerPart = input.slice(0, delimitedCharIndex) || '0';
|
||||
const decimalPart = decimalPlaces ? input.slice(delimitedCharIndex, length) + "0".repeat(decimalPlaces) : "";
|
||||
|
||||
return integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, " ") + (decimalPart ? "." + decimalPart.slice(0, decimalPlaces) : "");
|
||||
return integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, ",") + (decimalPart ? "." + decimalPart.slice(0, decimalPlaces) : "");
|
||||
}
|
||||
|
||||
static convertENotationToString(num: number | string): string {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue