Skip to content

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

Feature/restore support for specific calendar year date ranges in assistant (#6079)

Thomas Kaul5102e1a3a939
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 25637b578e..a222089a57 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
+- Restored the support for specific calendar year date ranges (`2024`, `2023`, `2022`, etc.) in the assistant (experimental)
- Removed the deprecated _Angular CLI_ decorator (`decorate-angular-cli.js`)
- Refreshed the cryptocurrencies list
diff --git a/libs/ui/src/lib/assistant/assistant.component.ts b/libs/ui/src/lib/assistant/assistant.component.ts
index e9c6e77b30..7bbc3978cc 100644
--- a/libs/ui/src/lib/assistant/assistant.component.ts
+++ b/libs/ui/src/lib/assistant/assistant.component.ts
@@ -33,7 +33,7 @@ import { MatSelectModule } from '@angular/material/select';
import { RouterModule } from '@angular/router';
import { IonIcon } from '@ionic/angular/standalone';
import { AssetClass, DataSource } from '@prisma/client';
-import { differenceInYears } from 'date-fns';
+import { differenceInYears, eachYearOfInterval, format } from 'date-fns';
import Fuse from 'fuse.js';
import { addIcons } from 'ionicons';
import {
@@ -389,20 +389,19 @@ export class GfAssistantComponent implements OnChanges, OnDestroy, OnInit {
});
}
- // TODO
- // if (this.user?.settings?.isExperimentalFeatures) {
- // this.dateRangeOptions = this.dateRangeOptions.concat(
- // eachYearOfInterval({
- // end: new Date(),
- // start: this.user?.dateOfFirstActivity ?? new Date()
- // })
- // .map((date) => {
- // return { label: format(date, 'yyyy'), value: format(date, 'yyyy') };
- // })
- // .slice(0, -1)
- // .reverse()
- // );
- // }
+ if (this.user?.settings?.isExperimentalFeatures) {
+ this.dateRangeOptions = this.dateRangeOptions.concat(
+ eachYearOfInterval({
+ end: new Date(),
+ start: this.user?.dateOfFirstActivity ?? new Date()
+ })
+ .map((date) => {
+ return { label: format(date, 'yyyy'), value: format(date, 'yyyy') };
+ })
+ .slice(0, -1)
+ .reverse()
+ );
+ }
if (
this.user?.dateOfFirstActivity &&