X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fshared%2Fshared-main%2Fangular%2Fnumber-formatter.pipe.ts;h=00cfbc692b441dc88ea22d8d309ec4bf06693818;hb=d0fbc9fd0a29c37f3ff9b99030351e90b276fe7d;hp=8badb1573d3f37f55f8c3813de7a7478f84321d0;hpb=3c904c6893550c2205455c3f02fce5a363a0283f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts b/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts index 8badb1573..00cfbc692 100644 --- a/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts +++ b/client/src/app/shared/shared-main/angular/number-formatter.pipe.ts @@ -13,15 +13,16 @@ export class NumberFormatterPipe implements PipeTransform { static getDecimalForNumber (x: number, n = 1) { const v = x.toString().split('.') const f = v[1] || '' - if (f.length > n) return +f.substr(0, n) + if (f.length > n) return +f.substring(0, n) return +f } - private dictionary: Array<{max: number, type: string}> = [ + private dictionary: { max: number, type: string }[] = [ { max: 1000, type: '' }, { max: 1000000, type: 'K' }, { max: 1000000000, type: 'M' } ] + constructor (@Inject(LOCALE_ID) private localeId: string) {} transform (value: number) {