From 9169bc231e802052d3a845d1f7ee9bb24de753fe Mon Sep 17 00:00:00 2001 From: Konstantin Date: Thu, 30 Jan 2025 08:37:35 +0100 Subject: [PATCH] feat: Use default format version in dropdown --- .../format-version-select.component.ts | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/app/features/ahbs/components/format-version-select/format-version-select.component.ts b/src/app/features/ahbs/components/format-version-select/format-version-select.component.ts index 20385a010..5e3fcad9e 100644 --- a/src/app/features/ahbs/components/format-version-select/format-version-select.component.ts +++ b/src/app/features/ahbs/components/format-version-select/format-version-select.component.ts @@ -41,10 +41,24 @@ export class FormatVersionSelectComponent implements ControlValueAccessor, OnIni label: this.getFormatVersionDate(v), })) ), - tap(() => this.control.enable()) + tap(() => { + const defaultVersion = this.getDefaultFormatVersion(); + this.control.setValue(defaultVersion); + if (this.onChange) { + this.onChange(defaultVersion); + } + this.control.enable(); + }) ); } + /** + * Returns the default format version based on a hardcoded date check. + */ + private getDefaultFormatVersion(): string { + const keyDate24hLFW = new Date('2025-06-06'); + return new Date() < keyDate24hLFW ? 'FV2410' : 'FV2504'; + } writeValue(formatVersion: string): void { this.control.setValue(formatVersion); } @@ -75,7 +89,7 @@ export class FormatVersionSelectComponent implements ControlValueAccessor, OnIni FV2310: 'Oktober 2023 (FV2310)', FV2404: 'April 2024 (FV2404)', FV2410: 'Oktober 2024 (FV2410)', - FV2504: 'April 2025 (FV2504)', + FV2504: 'Juni 2025 (FV2504)', FV2510: 'Oktober 2025 (FV2510)', }; return mapping[formatVersion] || formatVersion;