[ADF-3494] date format fix (#3762)

* fix date formats for columns

* fix date formatting for columns

* fix data binding support
This commit is contained in:
Denys Vuika
2018-09-10 14:43:57 +01:00
committed by Eugenio Romano
parent 1ff4b3a322
commit 5b534c409f

View File

@@ -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';
}
}
}