Fix date conversion in import of historical market data (#3117)

* Fix date conversion in import of historical market data

* Update changelog
pull/3143/head^2
helgehatt 7 months ago committed by GitHub
parent 40d93066ff
commit a0ddd1f9b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## Unreleased
### Fixed
- Fixed the date conversion of the import of historical market data in the admin control panel
## 2.63.2 - 2024-03-12
### Added

@ -155,15 +155,14 @@ export class AdminMarketDataDetailComponent implements OnChanges, OnInit {
day: string;
yearMonth: string;
}) {
const date = parseISO(`${yearMonth}-${day}`);
const marketPrice = this.marketDataByMonth[yearMonth]?.[day]?.marketPrice;
const dialogRef = this.dialog.open(MarketDataDetailDialog, {
data: <MarketDataDetailDialogParams>{
date,
marketPrice,
currency: this.currency,
dataSource: this.dataSource,
dateString: `${yearMonth}-${day}`,
symbol: this.symbol,
user: this.user
},

@ -5,7 +5,7 @@ import { DataSource } from '@prisma/client';
export interface MarketDataDetailDialogParams {
currency: string;
dataSource: DataSource;
date: Date;
dateString: string;
marketPrice: number;
symbol: string;
user: User;

@ -45,7 +45,7 @@ export class MarketDataDetailDialog implements OnDestroy {
this.adminService
.fetchSymbolForDate({
dataSource: this.data.dataSource,
date: this.data.date,
dateString: this.data.dateString,
symbol: this.data.symbol
})
.pipe(takeUntil(this.unsubscribeSubject))
@ -63,7 +63,7 @@ export class MarketDataDetailDialog implements OnDestroy {
marketData: {
marketData: [
{
date: this.data.date.toISOString(),
date: this.data.dateString,
marketPrice: this.data.marketPrice
}
]

@ -9,7 +9,7 @@
matInput
name="date"
[matDatepicker]="date"
[(ngModel)]="data.date"
[(ngModel)]="data.dateString"
/>
<mat-datepicker-toggle class="mr-2" matSuffix [for]="date">
<ion-icon

@ -1,4 +1,5 @@
import { UpdateAssetProfileDto } from '@ghostfolio/api/app/admin/update-asset-profile.dto';
import { UpdateMarketDataDto } from '@ghostfolio/api/app/admin/update-market-data.dto';
import { AdminService } from '@ghostfolio/client/services/admin.service';
import { DataService } from '@ghostfolio/client/services/data.service';
import { DATE_FORMAT, parseDate } from '@ghostfolio/common/helper';
@ -195,15 +196,13 @@ export class AssetProfileDialog implements OnDestroy, OnInit {
header: true,
skipEmptyLines: true
}
).data;
).data as UpdateMarketDataDto[];
this.adminService
.postMarketData({
dataSource: this.data.dataSource,
marketData: {
marketData: marketData.map(({ date, marketPrice }) => {
return { marketPrice, date: parseDate(date).toISOString() };
})
marketData
},
symbol: this.data.symbol
})

@ -188,17 +188,14 @@ export class AdminService {
public fetchSymbolForDate({
dataSource,
date,
dateString,
symbol
}: {
dataSource: DataSource;
date: Date;
dateString: string;
symbol: string;
}) {
const url = `/api/v1/symbol/${dataSource}/${symbol}/${format(
date,
DATE_FORMAT
)}`;
const url = `/api/v1/symbol/${dataSource}/${symbol}/${dateString}`;
return this.http.get<IDataProviderHistoricalResponse>(url);
}

Loading…
Cancel
Save