diff --git a/server.js b/server.js index 0ab9470..c0819fe 100644 --- a/server.js +++ b/server.js @@ -72,6 +72,16 @@ app.get('/', function(req, res){ console.log(err); } else { //console.log(rows); + + // Loop over elements in rows array, convert ugly UTC times to pretty local times. + rows.forEach(function(row){ + var localDtTm = moment.utc(new Date(row.MaxPub)); + localDtTm = moment(localDtTm).tz('America/New_York').format('MM-DD-YYYY HH:mm:ss'); + row.MaxPub = localDtTm; + row.MaxPubDate = moment(localDtTm).format('MM-DD-YYYY'); + row.MaxPubTime = moment(localDtTm).format('h:mm:ss a'); + }); + res.render('index', {cores: rows}, function(err, html) { if(err !== null) { console.log(err); diff --git a/views/index.hbs b/views/index.hbs index d1aad24..8d85bae 100644 --- a/views/index.hbs +++ b/views/index.hbs @@ -8,6 +8,7 @@ Location Last Update + @@ -33,7 +34,8 @@ Edit Details {{/if}} - {{this.MaxPub}} + {{this.MaxPubDate}} + {{this.MaxPubTime}} {{this.MaxStatus}} {{/each}}