mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 20:47:54 +00:00
26 lines
760 B
TypeScript
26 lines
760 B
TypeScript
import { Injectable } from '@angular/core';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class SortService {
|
|
|
|
constructor() { }
|
|
|
|
sortArrayISODate(myArray: any) {
|
|
if(myArray.length > 0){
|
|
return myArray.sort(function (a, b) {
|
|
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
|
|
});
|
|
}
|
|
}
|
|
sortArrayByDate(myArray: any) {
|
|
console.log(myArray[0].taskStartDate);
|
|
if(myArray.length > 0){
|
|
return myArray.sort(function (a, b) {
|
|
return (new Date(a.workflowInstanceDataFields.StartDate) < new Date(b.workflowInstanceDataFields.StartDate)) ? -1 : ((new Date(a.workflowInstanceDataFields.StartDate) > new Date(b.workflowInstanceDataFields.StartDate)) ? 1 : 0);
|
|
});
|
|
}
|
|
}
|
|
}
|