Skip to content

Commit

Permalink
normalize timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsteward committed Apr 24, 2020
1 parent b1ea705 commit 273dfd6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ router.get('/', function(req, res, next) {

// calculate the age of the data
// freshness = number of hours old
const now = new Date().toLocaleString('en-US', {timeZone: "America/New_York"});
const exportdate = new Date(data.dateoflastexport);
let now = new Date();
now = new Date(now.toUTCString());

let exportdate = new Date(data.dateoflastexport);
exportdate = new Date(exportdate.toUTCString());

const freshness = Math.round((now - exportdate)/3600000);
data.datafreshness = freshness;

Expand Down

0 comments on commit 273dfd6

Please sign in to comment.