aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Eilertsen <haraldei@anduin.net>2019-10-05 11:44:41 +0200
committerHarald Eilertsen <haraldei@anduin.net>2019-10-05 11:44:41 +0200
commitaa41ebfc002f98a0dcab5f5d8ea90cc8ce74406e (patch)
treec621ceeaf9ffe04023fd8e6d772f586dbff16ccc
parent871f923a8c378cab7aed28d9cc1af69797934cc2 (diff)
downloadramaskrik-social-aa41ebfc002f98a0dcab5f5d8ea90cc8ce74406e.tar.gz
ramaskrik-social-aa41ebfc002f98a0dcab5f5d8ea90cc8ce74406e.tar.bz2
ramaskrik-social-aa41ebfc002f98a0dcab5f5d8ea90cc8ce74406e.zip
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.
-rw-r--r--public/js/app.js12
1 files 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)