|
@ -7,6 +7,7 @@ import { |
|
|
OnInit, |
|
|
OnInit, |
|
|
Output |
|
|
Output |
|
|
} from '@angular/core'; |
|
|
} from '@angular/core'; |
|
|
|
|
|
import { getDateFnsLocale } from '@ghostfolio/common/helper'; |
|
|
import { PortfolioSummary } from '@ghostfolio/common/interfaces'; |
|
|
import { PortfolioSummary } from '@ghostfolio/common/interfaces'; |
|
|
import { formatDistanceToNow } from 'date-fns'; |
|
|
import { formatDistanceToNow } from 'date-fns'; |
|
|
|
|
|
|
|
@ -20,6 +21,7 @@ export class PortfolioSummaryComponent implements OnChanges, OnInit { |
|
|
@Input() baseCurrency: string; |
|
|
@Input() baseCurrency: string; |
|
|
@Input() hasPermissionToUpdateUserSettings: boolean; |
|
|
@Input() hasPermissionToUpdateUserSettings: boolean; |
|
|
@Input() isLoading: boolean; |
|
|
@Input() isLoading: boolean; |
|
|
|
|
|
@Input() language: string; |
|
|
@Input() locale: string; |
|
|
@Input() locale: string; |
|
|
@Input() summary: PortfolioSummary; |
|
|
@Input() summary: PortfolioSummary; |
|
|
|
|
|
|
|
@ -34,7 +36,9 @@ export class PortfolioSummaryComponent implements OnChanges, OnInit { |
|
|
public ngOnChanges() { |
|
|
public ngOnChanges() { |
|
|
if (this.summary) { |
|
|
if (this.summary) { |
|
|
if (this.summary.firstOrderDate) { |
|
|
if (this.summary.firstOrderDate) { |
|
|
this.timeInMarket = formatDistanceToNow(this.summary.firstOrderDate); |
|
|
this.timeInMarket = formatDistanceToNow(this.summary.firstOrderDate, { |
|
|
|
|
|
locale: getDateFnsLocale(this.language) |
|
|
|
|
|
}); |
|
|
} else { |
|
|
} else { |
|
|
this.timeInMarket = '-'; |
|
|
this.timeInMarket = '-'; |
|
|
} |
|
|
} |
|
|