diff --git a/lib/core/src/lib/datatable/components/date-cell/date-cell.component.ts b/lib/core/src/lib/datatable/components/date-cell/date-cell.component.ts index 9ba78d30f1..d913f6b3b4 100644 --- a/lib/core/src/lib/datatable/components/date-cell/date-cell.component.ts +++ b/lib/core/src/lib/datatable/components/date-cell/date-cell.component.ts @@ -26,7 +26,9 @@ import { toSignal } from '@angular/core/rxjs-interop'; selector: 'adf-date-cell', template: ` @if (formattedDate()) { - {{ formattedDate() }} + } `, encapsulation: ViewEncapsulation.None, @@ -55,6 +57,12 @@ export class DateCellComponent extends DataTableCellComponent implements OnInit // Convert value$ observable to signal for reactive computation private readonly dateValue = toSignal(this.value$); + // Computed signal that automatically formats the date to ISO string for datetime attribute + protected readonly isoDate = computed(() => { + const date = this.dateValue(); + return date ? new Date(date).toISOString() : ''; + }); + // Computed signal that automatically formats the date based on value and config protected readonly formattedDate = computed(() => { const date = this.dateValue();