Implemented sort for records

This commit is contained in:
Tim Zieger 2020-06-01 10:44:45 +02:00
parent daf542c527
commit 04c9b7b55f

View File

@ -97,7 +97,7 @@ export default {
var min = time % 60; var min = time % 60;
record.duration = hours + "h " + min + "min"; record.duration = hours + "h " + min + "min";
var start = record.startdate; var start = record.startdate;
records[index].completeStartDate = start;
start = start.split("T"); start = start.split("T");
records[index].startdate = start[1]; records[index].startdate = start[1];
records[index].date = start[0]; records[index].date = start[0];
@ -110,6 +110,11 @@ export default {
records[index].enddate = "pending"; records[index].enddate = "pending";
} }
} }
records.sort(function(a, b) {
a = new Date(a.completeStartDate);
b = new Date(b.completeStartDate);
return a>b ? -1 : a<b ? 1 : 0;
});
this.timeRecords = records; this.timeRecords = records;
} }
}; };