From 10ebc9c7983668ee0b30568a37aee87c147b154b Mon Sep 17 00:00:00 2001 From: Thomas Kaul <4159106+dtslvr@users.noreply.github.com> Date: Sat, 20 Dec 2025 11:23:38 +0100 Subject: [PATCH] Restore specific calendar year date ranges --- .../src/lib/assistant/assistant.component.ts | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) 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 &&