From 5b534c409f8a83fb367ed6eb7e0bb1c103eaf271 Mon Sep 17 00:00:00 2001 From: Denys Vuika Date: Mon, 10 Sep 2018 14:43:57 +0100 Subject: [PATCH] [ADF-3494] date format fix (#3762) * fix date formats for columns * fix date formatting for columns * fix data binding support --- .../datatable/date-cell.component.ts | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) 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'; - } - } }