From e91ef93e454e9755c163134f19c22091f1476a00 Mon Sep 17 00:00:00 2001 From: KenTandrian Date: Sun, 15 Feb 2026 23:41:44 +0700 Subject: [PATCH] feat(lib): change defaultDateFormat to computed signal --- .../historical-market-data-editor.component.html | 2 +- .../historical-market-data-editor.component.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html index 4483a6657..0e4d8eeb9 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html @@ -17,7 +17,7 @@ }" [title]=" (`${itemByMonth.key}-${formatDay(i + 1)}` - | date: defaultDateFormat) ?? '' + | date: defaultDateFormat()) ?? '' " (click)=" onOpenMarketDataDetail({ diff --git a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts index d99e78e20..6f81f84c5 100644 --- a/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts +++ b/libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts @@ -12,6 +12,7 @@ import type { HttpErrorResponse } from '@angular/common/http'; import { ChangeDetectionStrategy, Component, + computed, EventEmitter, input, Input, @@ -72,7 +73,6 @@ export class GfHistoricalMarketDataEditorComponent @Output() marketDataChanged = new EventEmitter(); - public defaultDateFormat: string; public deviceType: string; public historicalDataForm = this.formBuilder.group({ historicalData: this.formBuilder.group({ @@ -93,6 +93,9 @@ export class GfHistoricalMarketDataEditorComponent public readonly locale = input(getLocale()); protected readonly days = Array(31); + protected readonly defaultDateFormat = computed(() => + getDateFormatString(this.locale()) + ); private unsubscribeSubject = new Subject(); @@ -111,8 +114,6 @@ export class GfHistoricalMarketDataEditorComponent } public ngOnChanges() { - this.defaultDateFormat = getDateFormatString(this.locale()); - this.historicalDataItems = this.marketData.map(({ date, marketPrice }) => { return { date: format(date, DATE_FORMAT),