Merge pull request #3220 from mempool/mononaut/fiat-decimals

drop decimal places from large fiat values
This commit is contained in:
softsimon 2023-03-04 16:55:05 +09:00 committed by GitHub
commit fdcf4ce501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,6 +23,10 @@ export class FiatCurrencyPipe implements PipeTransform {
const digits = args[0] || 1; const digits = args[0] || 1;
const currency = args[1] || this.currency || 'USD'; const currency = args[1] || this.currency || 'USD';
return new Intl.NumberFormat(this.locale, { style: 'currency', currency }).format(num); if (num >= 1000) {
return new Intl.NumberFormat(this.locale, { style: 'currency', currency, maximumFractionDigits: 0 }).format(num);
} else {
return new Intl.NumberFormat(this.locale, { style: 'currency', currency }).format(num);
}
} }
} }