|
|
@ -37,11 +37,11 @@ import { |
|
|
format, |
|
|
format, |
|
|
isBefore, |
|
|
isBefore, |
|
|
isSameDay, |
|
|
isSameDay, |
|
|
|
|
|
isToday, |
|
|
isValid, |
|
|
isValid, |
|
|
min, |
|
|
min, |
|
|
parse, |
|
|
parse, |
|
|
parseISO, |
|
|
parseISO |
|
|
startOfToday |
|
|
|
|
|
} from 'date-fns'; |
|
|
} from 'date-fns'; |
|
|
import ms from 'ms'; |
|
|
import ms from 'ms'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
import { DeviceDetectorService } from 'ngx-device-detector'; |
|
|
@ -152,8 +152,11 @@ export class GfHistoricalMarketDataEditorComponent |
|
|
|
|
|
|
|
|
const marketDataItems = [...missingMarketData, ...this.marketData()]; |
|
|
const marketDataItems = [...missingMarketData, ...this.marketData()]; |
|
|
|
|
|
|
|
|
const lastDate = marketDataItems.at(-1)?.date; |
|
|
const hasMarketDataOfToday = marketDataItems.some(({ date }) => { |
|
|
if (!lastDate || isBefore(lastDate, startOfToday())) { |
|
|
return isToday(date); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
if (!hasMarketDataOfToday) { |
|
|
marketDataItems.push({ date: new Date() }); |
|
|
marketDataItems.push({ date: new Date() }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|