Merge pull request #967 from danielyxie/dev

Hotfix very large number to extend kmbt with qQsSon.
This commit is contained in:
hydroflame 2021-05-27 14:05:04 -04:00 committed by GitHub
commit 04b57f07a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -53,6 +53,15 @@ class NumeralFormatter {
} }
formatMoney(n: number): string { formatMoney(n: number): string {
if(numeral.options.currentLocale === "en") {
const extraFormats = [1e15, 1e18, 1e21, 1e24, 1e27, 1e30];
const extraNotations = ['q', 'Q', 's', 'S', 'o', 'n'];
for(let i = 0; i < extraFormats.length; i++) {
if(extraFormats[i] < n && n <= extraFormats[i]*1000) {
return '$'+this.format(n/extraFormats[i], '0.000')+extraNotations[i];
}
}
}
if(Math.abs(n) < 1000) { if(Math.abs(n) < 1000) {
return this.format(n, "$0.00"); return this.format(n, "$0.00");
} }