From d859ff9d0137b5da493f672fb44e6024eebee8d7 Mon Sep 17 00:00:00 2001 From: Jeff Steward Date: Thu, 22 Dec 2022 10:15:07 -0500 Subject: [PATCH] fix date calculate for last export --- modules/data.js | 2 ++ routes/index.js | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/data.js b/modules/data.js index 11fb6a9..04c246d 100644 --- a/modules/data.js +++ b/modules/data.js @@ -44,7 +44,9 @@ function getObjectStats(callback) { let output = { lastexport: e.toLocaleString('en-US', {timeZone: "America/New_York"}), + lastexport_raw: e, lastrefresh: d.toLocaleString('en-US', {timeZone: "America/New_York"}), + lastrefresh_raw: d, recordcount: results['info']['totalrecords'], recordcount_public: results['aggregations']['by_accesslevel']['buckets'][0]['doc_count'] }; diff --git a/routes/index.js b/routes/index.js index 6a480dd..afe2e1d 100644 --- a/routes/index.js +++ b/routes/index.js @@ -57,6 +57,7 @@ router.get('/', function(req, res, next) { function(err, results) { data.dateoflastrefresh = results['objectStats']['lastrefresh']; data.dateoflastexport = results['objectStats']['lastexport']; + data.dateoflastexport_raw = results['objectStats']['lastexport_raw']; data.objects.count = results['objectStats']['recordcount']; data.objects.count_as_string = data.objects.count.toLocaleString('en'); data.objects.public.count = results['objectStats']['recordcount_public']; @@ -84,7 +85,7 @@ router.get('/', function(req, res, next) { let now = new Date(); now = new Date(now.toUTCString()); - let exportdate = new Date(data.dateoflastexport); + let exportdate = new Date(data.dateoflastexport_raw); exportdate = new Date(exportdate.toUTCString()); const freshness = Math.round((now - exportdate)/3600000);