Skip to content

Commit

Permalink
fix date calculate for last export
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsteward committed Dec 22, 2022
1 parent 6b95384 commit d859ff9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -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']
};
Expand Down
3 changes: 2 additions & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit d859ff9

Please sign in to comment.