Browse Source

feat(lib): change defaultDateFormat to computed signal

pull/6337/head
KenTandrian 1 month ago
parent
commit
e91ef93e45
  1. 2
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.html
  2. 7
      libs/ui/src/lib/historical-market-data-editor/historical-market-data-editor.component.ts

2
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({

7
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<boolean>();
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<void>();
@ -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),

Loading…
Cancel
Save