From aa41ebfc002f98a0dcab5f5d8ea90cc8ce74406e Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 5 Oct 2019 11:44:41 +0200 Subject: Only convert final start/end_time to date objects. This makes the sort come out right, and there's no need to create a bunch of objects we just throw away. --- public/js/app.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/public/js/app.js b/public/js/app.js index 7c1f37b..f256c84 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -146,14 +146,14 @@ window.addEventListener("load", function() { console.log(date) let s = screenings_by_date.get(date) - let start_time = s - .map( el => new Date(el.start_time) ) + let start_time = new Date(s + .map( el => el.start_time ) .sort() - .shift() - let end_time = s - .map( el => new Date(el.end_time) ) + .shift()) + let end_time = new Date(s + .map( el => el.end_time ) .sort() - .pop() + .pop()) console.log(" Start time: " + start_time) console.log(" End time : " + end_time) -- cgit v1.2.3