diff --git a/lib/process-services/task-list/components/task-list.component.spec.ts b/lib/process-services/task-list/components/task-list.component.spec.ts index 3488520b6f..dfdfacacde 100644 --- a/lib/process-services/task-list/components/task-list.component.spec.ts +++ b/lib/process-services/task-list/components/task-list.component.spec.ts @@ -122,9 +122,9 @@ describe('TaskListComponent', () => { expect(component.rows[0]['assignee'].firstName).toEqual('firstNameFake1'); expect(component.rows[0]['assignee'].lastName).toEqual('lastNameFake1'); expect(component.rows[0][('assignee')].email).toEqual('emailFake1'); - expect(component.rows[0]['created']).toEqual('2017-03-01T12:25:17.189+0000'); - expect(component.rows[0]['dueDate']).toEqual('2017-04-02T12:25:17.189+0000'); - expect(component.rows[0]['endDate']).toEqual('2017-05-03T12:25:31.129+0000'); + expect(component.rows[0]['created']).toEqual('Mar 1, 2017'); + expect(component.rows[0]['dueDate']).toEqual('Apr 2, 2017'); + expect(component.rows[0]['endDate']).toEqual('May 3, 2017'); expect(component.rows[0]['duration']).toEqual(13940); expect(component.rows[0]['priority']).toEqual(50); expect(component.rows[0]['parentTaskId']).toEqual(1); diff --git a/lib/process-services/task-list/components/task-list.component.ts b/lib/process-services/task-list/components/task-list.component.ts index a8f077862b..b59381c197 100644 --- a/lib/process-services/task-list/components/task-list.component.ts +++ b/lib/process-services/task-list/components/task-list.component.ts @@ -38,6 +38,7 @@ import moment from 'moment-es6'; export class TaskListComponent extends DataTableSchema implements OnChanges, AfterContentInit, PaginatedComponent { static PRESET_KEY = 'adf-task-list.presets'; + public FORMAT_DATE: string = 'll'; @ContentChild(EmptyCustomContentDirective) emptyCustomContent: EmptyCustomContentDirective; @@ -251,7 +252,7 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft this.isLoading = true; this.loadTasksByState().subscribe( (tasks) => { - this.rows = this.optimizeNames(tasks.data); + this.rows = this.optimizeTaskDetails(tasks.data); this.selectTask(this.landingTaskId); this.success.emit(tasks); this.isLoading = false; @@ -345,12 +346,21 @@ export class TaskListComponent extends DataTableSchema implements OnChanges, Aft * Optimize name field * @param instances */ - private optimizeNames(instances: any[]): any[] { - instances = instances.map(t => { - if (!t.name) { - t.name = 'No name'; + private optimizeTaskDetails(instances: any[]): any[] { + instances = instances.map(task => { + if (!task.name) { + task.name = 'No name'; } - return t; + if (task.created) { + task.created = moment(task.created).format(this.FORMAT_DATE); + } + if (task.dueDate) { + task.dueDate = moment(task.dueDate).format(this.FORMAT_DATE); + } + if (task.endDate) { + task.endDate = moment(task.endDate).format(this.FORMAT_DATE); + } + return task; }); return instances; }