Fix fiat pipe

This commit is contained in:
Felipe Knorr Kuhn 2026-03-07 12:14:29 -08:00
parent 54eae4ee7b
commit 5d0e4e65d1
No known key found for this signature in database
GPG key ID: 79619B52BB097C1A

View file

@ -21,17 +21,7 @@ export class FiatCurrencyPipe implements PipeTransform {
}
transform(num: number, ...args: any[]): unknown {
const digits = args[0] || 1;
const currency = args[1] || this.currency || 'USD';
if (Math.abs(num) >= 1000) {
// Check if decimals are exactly 0
if (num % 1 === 0) {
return new Intl.NumberFormat(this.locale, { style: 'currency', currency, maximumFractionDigits: 0 }).format(num);
}
return new Intl.NumberFormat(this.locale, { style: 'currency', currency, minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(num);
} else {
return new Intl.NumberFormat(this.locale, { style: 'currency', currency }).format(num);
}
return new Intl.NumberFormat(this.locale, { style: 'currency', currency }).format(num);
}
}