Browse Source

Bugfix/change client-side dates to be sent in UTC format (#4402)

* Change client-side dates to be sent in UTC format

* Update changelog
pull/4451/merge
Chang-Yen Tseng 2 days ago
committed by GitHub
parent
commit
235db72ade
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      CHANGELOG.md
  2. 17
      apps/client/src/app/services/admin.service.ts
  3. 8
      apps/client/src/app/services/data.service.ts
  4. 6
      package-lock.json
  5. 1
      package.json

3
CHANGELOG.md

@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Fixed an issue in the activities import functionality related to the account balances
- Changed client-side dates to be sent in UTC format to ensure date consistency
- Benchmark endpoint
- Exchange rate endpoint
## 2.146.0 - 2025-03-15

17
apps/client/src/app/services/admin.service.ts

@ -8,7 +8,6 @@ import {
PROPERTY_API_KEY_GHOSTFOLIO
} from '@ghostfolio/common/config';
import { DEFAULT_PAGE_SIZE } from '@ghostfolio/common/config';
import { DATE_FORMAT } from '@ghostfolio/common/helper';
import {
AssetProfileIdentifier,
AdminData,
@ -25,7 +24,6 @@ import { Injectable } from '@angular/core';
import { SortDirection } from '@angular/material/sort';
import { DataSource, MarketData, Platform } from '@prisma/client';
import { JobStatus } from 'bull';
import { format } from 'date-fns';
import { switchMap } from 'rxjs';
import { environment } from '../../environments/environment';
@ -186,19 +184,8 @@ export class AdminService {
);
}
public gatherSymbol({
dataSource,
date,
symbol
}: AssetProfileIdentifier & {
date?: Date;
}) {
let url = `/api/v1/admin/gather/${dataSource}/${symbol}`;
if (date) {
url = `${url}/${format(date, DATE_FORMAT)}`;
}
public gatherSymbol({ dataSource, symbol }: AssetProfileIdentifier) {
const url = `/api/v1/admin/gather/${dataSource}/${symbol}`;
return this.http.post<MarketData | void>(url, {});
}

8
apps/client/src/app/services/data.service.ts

@ -57,6 +57,7 @@ import { translate } from '@ghostfolio/ui/i18n';
import { HttpClient, HttpParams } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { SortDirection } from '@angular/material/sort';
import { utc } from '@date-fns/utc';
import {
AccountBalance,
DataSource,
@ -281,7 +282,7 @@ export class DataService {
symbol: string;
}) {
return this.http.get<IDataProviderHistoricalResponse>(
`/api/v1/exchange-rate/${symbol}/${format(date, DATE_FORMAT)}`
`/api/v1/exchange-rate/${symbol}/${format(date, DATE_FORMAT, { in: utc })}`
);
}
@ -363,10 +364,7 @@ export class DataService {
}
return this.http.get<BenchmarkMarketDataDetails>(
`/api/v1/benchmarks/${dataSource}/${symbol}/${format(
startDate,
DATE_FORMAT
)}`,
`/api/v1/benchmarks/${dataSource}/${symbol}/${format(startDate, DATE_FORMAT, { in: utc })}`,
{ params }
);
}

6
package-lock.json

@ -22,6 +22,7 @@
"@angular/router": "19.2.1",
"@angular/service-worker": "19.2.1",
"@codewithdan/observable-store": "2.2.15",
"@date-fns/utc": "2.1.0",
"@dfinity/agent": "0.15.7",
"@dfinity/auth-client": "0.15.7",
"@dfinity/candid": "0.15.7",
@ -3113,6 +3114,11 @@
"dev": true,
"license": "MIT"
},
"node_modules/@date-fns/utc": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@date-fns/utc/-/utc-2.1.0.tgz",
"integrity": "sha512-176grgAgU2U303rD2/vcOmNg0kGPbhzckuH1TEP2al7n0AQipZIy9P15usd2TKQCG1g+E1jX/ZVQSzs4sUDwgA=="
},
"node_modules/@dfinity/agent": {
"version": "0.15.7",
"resolved": "https://registry.npmjs.org/@dfinity/agent/-/agent-0.15.7.tgz",

1
package.json

@ -68,6 +68,7 @@
"@angular/router": "19.2.1",
"@angular/service-worker": "19.2.1",
"@codewithdan/observable-store": "2.2.15",
"@date-fns/utc": "2.1.0",
"@dfinity/agent": "0.15.7",
"@dfinity/auth-client": "0.15.7",
"@dfinity/candid": "0.15.7",

Loading…
Cancel
Save