Feature/improve local number formatting in value component (#1992)

* Improve local number formatting

* Update changelog
This commit is contained in:
Thomas Kaul
2023-05-20 10:53:04 +02:00
committed by GitHub
parent 73c127f10c
commit 86296b3591
10 changed files with 86 additions and 22 deletions

View File

@@ -37,6 +37,8 @@ import { ImportResponse } from './responses/import-response.interface';
import { OAuthResponse } from './responses/oauth-response.interface';
import { PortfolioPerformanceResponse } from './responses/portfolio-performance-response.interface';
import { ScraperConfiguration } from './scraper-configuration.interface';
import { Statistics } from './statistics.interface';
import { Subscription } from './subscription.interface';
import { TimelinePosition } from './timeline-position.interface';
import { UniqueAsset } from './unique-asset.interface';
import { UserSettings } from './user-settings.interface';
@@ -80,6 +82,8 @@ export {
Position,
ResponseError,
ScraperConfiguration,
Statistics,
Subscription,
TimelinePosition,
UniqueAsset,
User,

View File

@@ -21,7 +21,7 @@ export class ValueComponent implements OnChanges {
@Input() isCurrency = false;
@Input() isDate = false;
@Input() isPercent = false;
@Input() locale = getLocale();
@Input() locale: string | undefined;
@Input() position = '';
@Input() precision: number | undefined;
@Input() size: 'large' | 'medium' | 'small' = 'small';
@@ -92,7 +92,7 @@ export class ValueComponent implements OnChanges {
});
} catch {}
} else {
this.formattedValue = this.value?.toString();
this.formattedValue = this.value?.toLocaleString(this.locale);
}
if (this.isAbsolute) {
@@ -128,6 +128,11 @@ export class ValueComponent implements OnChanges {
this.formattedValue = '';
this.isNumber = false;
this.isString = false;
if (!this.locale) {
this.locale = getLocale();
}
this.useAbsoluteValue = false;
}
}