From cb53a49210ecd0c35d52d914c678644696c77c56 Mon Sep 17 00:00:00 2001 From: Kenneth Barbour Date: Thu, 9 Jul 2020 21:23:00 -0400 Subject: [PATCH] display time if available --- frontend/sandbox/sandbox.js | 2 +- frontend/src/views/CurrentConditions.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/sandbox/sandbox.js b/frontend/sandbox/sandbox.js index 0ac054b..092a9a8 100755 --- a/frontend/sandbox/sandbox.js +++ b/frontend/sandbox/sandbox.js @@ -61,7 +61,7 @@ server = http.createServer(function(req, res) { if (pathname === "/weather/current") { res.writeHead(200, {'Content-Type': 'application/json'}); res.write(JSON.stringify({ - "time": new Date(), + "time": Math.floor(new Date().getTime()/1000), "temperature": 24, "pressure": 101361.7, "humidity": 55, diff --git a/frontend/src/views/CurrentConditions.js b/frontend/src/views/CurrentConditions.js index 700fdad..e3ec15c 100644 --- a/frontend/src/views/CurrentConditions.js +++ b/frontend/src/views/CurrentConditions.js @@ -73,6 +73,7 @@ class CurrentConditions { return (

Current Conditions

+ {Weather.current.time && (

as of {new Date(Weather.current.time*1000).toLocaleString()}

)}