From 04c9b7b55f087bc93c63faf109209a14f3cb5ac9 Mon Sep 17 00:00:00 2001 From: Tim Zieger Date: Mon, 1 Jun 2020 10:44:45 +0200 Subject: [PATCH] Implemented sort for records --- frontend/src/views/TimeRecords.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/TimeRecords.vue b/frontend/src/views/TimeRecords.vue index c14792f..bb49961 100644 --- a/frontend/src/views/TimeRecords.vue +++ b/frontend/src/views/TimeRecords.vue @@ -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