diff --git a/lib/core/datatable/components/datatable/date-cell.component.ts b/lib/core/datatable/components/datatable/date-cell.component.ts index d3fe7344d1..29ae1abe31 100644 --- a/lib/core/datatable/components/datatable/date-cell.component.ts +++ b/lib/core/datatable/components/datatable/date-cell.component.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { Component, ViewEncapsulation, OnInit } from '@angular/core'; +import { Component, ViewEncapsulation } from '@angular/core'; import { DataTableCellComponent } from './datatable-cell.component'; import { UserPreferencesService, @@ -40,9 +40,15 @@ import { encapsulation: ViewEncapsulation.None, host: { class: 'adf-date-cell' } }) -export class DateCellComponent extends DataTableCellComponent implements OnInit { +export class DateCellComponent extends DataTableCellComponent { currentLocale; - format = 'medium'; + + get format(): string { + if (this.column) { + return this.column.format || 'medium'; + } + return 'medium'; + } constructor(userPreferenceService: UserPreferencesService) { super(); @@ -55,12 +61,4 @@ export class DateCellComponent extends DataTableCellComponent implements OnInit }); } } - - ngOnInit() { - super.ngOnInit(); - - if (this.column) { - this.format = this.column.format || 'medium'; - } - } }