handle date in current conditions

master
Kenneth Barbour 2020-06-20 16:39:16 -04:00
parent 7f9f6595e9
commit 836f99555c
1 changed files with 10 additions and 1 deletions

View File

@ -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'),