|
|
|
@ -123,8 +123,14 @@ export class GfHistoricalMarketDataEditorComponent |
|
|
|
} |
|
|
|
|
|
|
|
public ngOnChanges() { |
|
|
|
if (this.dateOfFirstActivity) { |
|
|
|
let date = this.dateOfFirstActivity; |
|
|
|
const startDate = |
|
|
|
this.dateOfFirstActivity ?? first(this.marketData())?.date; |
|
|
|
|
|
|
|
if (!startDate) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
let date = startDate; |
|
|
|
|
|
|
|
const missingMarketData: { date: Date; marketPrice?: number }[] = []; |
|
|
|
|
|
|
|
@ -173,16 +179,15 @@ export class GfHistoricalMarketDataEditorComponent |
|
|
|
// Fill up missing months
|
|
|
|
const dates = Object.keys(this.marketDataByMonth).sort(); |
|
|
|
const startDateString = first(dates); |
|
|
|
const startDate = min([ |
|
|
|
this.dateOfFirstActivity, |
|
|
|
...(startDateString ? [parseISO(startDateString)] : []) |
|
|
|
]); |
|
|
|
const endDateString = last(dates); |
|
|
|
|
|
|
|
if (endDateString) { |
|
|
|
const endDate = parseISO(endDateString); |
|
|
|
|
|
|
|
let currentDate = startDate; |
|
|
|
let currentDate = min([ |
|
|
|
startDate, |
|
|
|
...(startDateString ? [parseISO(startDateString)] : []) |
|
|
|
]); |
|
|
|
|
|
|
|
while (isBefore(currentDate, endDate)) { |
|
|
|
const key = format(currentDate, 'yyyy-MM'); |
|
|
|
@ -194,7 +199,6 @@ export class GfHistoricalMarketDataEditorComponent |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public formatDay(day: number): string { |
|
|
|
return day < 10 ? `0${day}` : `${day}`; |
|
|
|
|