diff --git a/CHANGELOG.md b/CHANGELOG.md index bc3e536b6f..76c84b9054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 duplicate data point of today in the chart of the holding detail dialog + ## 3.100.0 - 2026-11-15 ### Changed diff --git a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts index e08e4bfed6..4b7174b142 100644 --- a/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts +++ b/apps/client/src/app/components/holding-detail-dialog/holding-detail-dialog.component.ts @@ -70,7 +70,14 @@ import { MatTabsModule } from '@angular/material/tabs'; import { NavigationStart, Router, RouterModule } from '@angular/router'; import { IonIcon } from '@ionic/angular/standalone'; import { isUUID } from 'class-validator'; -import { format, isSameMonth, isToday, parseISO } from 'date-fns'; +import { + format, + isBefore, + isSameMonth, + isToday, + parseISO, + startOfToday +} from 'date-fns'; import { addIcons } from 'ionicons'; import { arrowDownCircleOutline, @@ -374,8 +381,15 @@ export class GfHoldingDetailDialogComponent implements OnInit { permissions.readMarketDataOfOwnAssetProfile ); - this.historicalDataItems = historicalData.map( - ({ averagePrice, date, marketPrice }) => { + const today = startOfToday(); + + this.historicalDataItems = historicalData + .filter(({ date }) => { + // Skip the market data from today on, the market price is added + // as the latest data point below + return isBefore(parseISO(date), today); + }) + .map(({ averagePrice, date, marketPrice }) => { this.benchmarkDataItems.push({ date, value: isNumber(averagePrice) ? averagePrice : null @@ -385,8 +399,7 @@ export class GfHoldingDetailDialogComponent implements OnInit { date, value: marketPrice ?? 0 }; - } - ); + }); this.investmentInBaseCurrencyWithCurrencyEffect = investmentInBaseCurrencyWithCurrencyEffect;