From 273dfd65438f87e786d00263a972933ed862d77f Mon Sep 17 00:00:00 2001 From: Jeff Steward Date: Fri, 24 Apr 2020 10:35:02 -0400 Subject: [PATCH] normalize timezones --- routes/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routes/index.js b/routes/index.js index 878b093..3b4506b 100644 --- a/routes/index.js +++ b/routes/index.js @@ -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;