This commit is contained in:
Peter Maquiran
2023-02-22 13:06:31 +01:00
parent 9c540d38b0
commit 623df60aeb
15 changed files with 243 additions and 381 deletions
+11 -2
View File
@@ -9,6 +9,10 @@ export class SortService {
constructor(private ObjectService: ObjectService) { }
sortArrayISODate(myArray: any) {
if(!Array.isArray(myArray)) {
myArray = []
}
if(myArray.length > 0){
return myArray.sort(function (a, b) {
return (a.CreateDate < b.CreateDate) ? -1 : ((a.CreateDate > b.CreateDate) ? 1 : 0);
@@ -17,7 +21,9 @@ export class SortService {
}
sortArrayByDate(myArray: any) {
if(!Array.isArray(myArray)) {
myArray = []
}
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);
@@ -26,7 +32,10 @@ export class SortService {
}
sortDate(array = [], path: string) {
if(!Array.isArray(array)) {
array = []
}
return array.sort( (a,b)=> {
return (new Date(this.ObjectService.deepFind(a, path)) < new Date(this.ObjectService.deepFind(b, path))) ? -1 : ((new Date(this.ObjectService.deepFind(a, path)) > new Date(this.ObjectService.deepFind(b, path))) ? 1 : 0);