diff --git a/CHANGELOG.md b/CHANGELOG.md index 25637b578..a222089a5 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 e9c6e77b3..7bbc3978c 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 &&