mirror of
https://github.com/mempool/mempool.git
synced 2024-11-20 10:21:52 +01:00
Merge pull request #813 from mempool/simon/significant-digits-fix
Fix for fee rounding not using locale
This commit is contained in:
commit
7ab1ce8fc4
@ -1,15 +1,20 @@
|
||||
import { Pipe, PipeTransform } from "@angular/core";
|
||||
import { formatNumber } from "@angular/common";
|
||||
import { Inject, LOCALE_ID, Pipe, PipeTransform } from "@angular/core";
|
||||
|
||||
@Pipe({
|
||||
name: "feeRounding",
|
||||
})
|
||||
export class FeeRoundingPipe implements PipeTransform {
|
||||
constructor(
|
||||
@Inject(LOCALE_ID) private locale: string,
|
||||
) {}
|
||||
|
||||
transform(fee: number): string {
|
||||
if (fee >= 100) {
|
||||
return fee.toFixed(0);
|
||||
return formatNumber(fee, this.locale, '1.0-0')
|
||||
} else if (fee < 10) {
|
||||
return fee.toFixed(2);
|
||||
return formatNumber(fee, this.locale, '1.2-2')
|
||||
}
|
||||
return fee.toFixed(1);
|
||||
return formatNumber(fee, this.locale, '1.1-1')
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user