From 836f99555c6c51cd25f9d98248176b515d5b557e Mon Sep 17 00:00:00 2001 From: Kenneth Barbour Date: Sat, 20 Jun 2020 16:39:16 -0400 Subject: [PATCH] handle date in current conditions --- frontend/src/views/CurrentView.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/CurrentView.js b/frontend/src/views/CurrentView.js index 295a527..ad47a10 100644 --- a/frontend/src/views/CurrentView.js +++ b/frontend/src/views/CurrentView.js @@ -10,10 +10,19 @@ var CurrentView = { return Weather.loadCurrent(); }, view: function() { + + let timeHeading = null; + if (Weather.current !== null && Weather.current.time) { + const currentTime = new Date(Weather.current.time*1000); + timeHeading = m('h2.subtitle', + 'as of ' + currentTime.toLocaleString() + ); + } + return m('div.section', [m('div.container', (Weather.current == null) ? [m('.notification', 'Loading current conditions...')] : [ m('h1.title', 'Current Conditions'), - m('h2.subtitle', 'as of ' + Weather.current.time), + timeHeading, m('.level', [ m('.level-item.has-text-centered', m("div",[ m('p.heading"', 'Temperature'),