From d6a965e6866fb73366eb2cf8b7ad1dd6486a228b Mon Sep 17 00:00:00 2001 From: Anton Franzluebbers Date: Thu, 23 Jun 2022 23:03:03 -0400 Subject: [PATCH] treat date as utc, fix for invalid headset id --- velconnect/static/js/util.js | 3 +-- velconnect/templates/index.html | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/velconnect/static/js/util.js b/velconnect/static/js/util.js index e386324..dae3ab8 100644 --- a/velconnect/static/js/util.js +++ b/velconnect/static/js/util.js @@ -98,7 +98,6 @@ function writeSrc(className, data) { } function timeSince(date) { - let seconds = Math.floor((new Date() - date) / 1000); let interval = seconds / 31536000; @@ -127,7 +126,7 @@ function timeSince(date) { function timeSinceString(date) { - date = Date.parse(date); + date = Date.parse(date + "Z"); let seconds = Math.floor((new Date() - date) / 1000); let interval = seconds / 31536000; diff --git a/velconnect/templates/index.html b/velconnect/templates/index.html index 2b350fd..8d6b095 100644 --- a/velconnect/templates/index.html +++ b/velconnect/templates/index.html @@ -152,6 +152,10 @@ console.log(resp); let respData = JSON.parse(resp); + if ("error" in respData) { + window.location.href = "/pair"; + } + writeClass('hw_id', respData['user']['hw_id']); writeValue('current_room', respData['user']['current_room']); writeClass('date_created', respData['user']['date_created'] + "
" + timeSinceString(respData['user']['date_created']) + " ago");