Merge branch '107-sort-timerecords-by-date' into 'master'

Resolve "Sort timerecords by date"

Closes #107

See merge request marcel.schwarz/2020ss-qbc-geofence-timetracking!92
This commit is contained in:
Tim Zieger 2020-06-01 08:53:21 +00:00
commit f2397c6c92

View File

@ -97,7 +97,7 @@ export default {
var min = time % 60;
record.duration = hours + "h " + min + "min";
var start = record.startdate;
records[index].completeStartDate = start;
start = start.split("T");
records[index].startdate = start[1];
records[index].date = start[0];
@ -110,6 +110,11 @@ export default {
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;
}
};