Fix order

This commit is contained in:
Peter Maquiran
2021-11-23 16:23:44 +01:00
parent 0fb342a463
commit 1f81744274
24 changed files with 134 additions and 78 deletions
+14 -1
View File
@@ -1,11 +1,12 @@
import { Injectable } from '@angular/core';
import { ObjectService } from './object.service';
@Injectable({
providedIn: 'root'
})
export class SortService {
constructor() { }
constructor(private ObjectService: ObjectService) { }
sortArrayISODate(myArray: any) {
if(myArray.length > 0){
@@ -14,6 +15,7 @@ export class SortService {
});
}
}
sortArrayByDate(myArray: any) {
console.log(myArray[0].taskStartDate);
if(myArray.length > 0){
@@ -22,4 +24,15 @@ export class SortService {
});
}
}
sortDate(array = [], path: string) {
return array.sort( (a,b)=> {
return new Date(this.ObjectService.deepFind(b, path)).getTime() -
new Date(this.ObjectService.deepFind(a, path)).getTime()
})
}
}