Skip to content

Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍

Feature/restore support for specific calendar year date ranges in holdings (#6186)

Thomas Kaul723e154e65ab
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a07743c349..5063cae440 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Set up the language localization for Korean (`ko`)
+### Changed
+
+- Restored the support for specific calendar year date ranges (`2024`, `2023`, `2022`, etc.) in the holdings table (experimental)
+
## 2.229.0 - 2026-01-11
### Changed
diff --git a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator.ts b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator.ts
index 2ceed015d6..fe912510ad 100644
--- a/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator.ts
+++ b/apps/api/src/app/portfolio/calculator/roai/portfolio-calculator.ts
@@ -13,7 +13,14 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance
import { Logger } from '@nestjs/common';
import { Big } from 'big.js';
-import { addMilliseconds, differenceInDays, format, isBefore } from 'date-fns';
+import {
+ addMilliseconds,
+ differenceInDays,
+ eachYearOfInterval,
+ format,
+ isBefore,
+ isThisYear
+} from 'date-fns';
import { cloneDeep, sortBy } from 'lodash';
export class RoaiPortfolioCalculator extends PortfolioCalculator {
@@ -837,15 +844,14 @@ export class RoaiPortfolioCalculator extends PortfolioCalculator {
'max',
'mtd',
'wtd',
- 'ytd'
- // TODO:
- // ...eachYearOfInterval({ end, start })
- // .filter((date) => {
- // return !isThisYear(date);
- // })
- // .map((date) => {
- // return format(date, 'yyyy');
- // })
+ 'ytd',
+ ...eachYearOfInterval({ end, start })
+ .filter((date) => {
+ return !isThisYear(date);
+ })
+ .map((date) => {
+ return format(date, 'yyyy');
+ })
] as DateRange[]) {
const dateInterval = getIntervalFromDateRange(dateRange);
const endDate = dateInterval.endDate;