Skip to content

Commit

Permalink
fix bad math
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffsteward committed Jan 3, 2023
1 parent 80bdefb commit 8595368
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions modules/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,7 @@ function getCurrentExhibitions(callback) {
now = new Date(now.toUTCString());

results['records'].forEach(r => {
let enddate = new Date(r['enddate']);
enddate.setDate(enddate.getDate() + 1);
let enddate = new Date(`${r['enddate']} 00:00:00`);
const diff = enddate.getTime() - now.getTime();
r.days_left = Math.round(diff/86400000);
r.enddate_long = enddate.toLocaleDateString('en-US', {weekday: 'long', year: "numeric", month: "long", day: "numeric",});
Expand All @@ -115,8 +114,7 @@ function getUpcomingExhibitions(callback) {
now = new Date(now.toUTCString());

results['records'].forEach(r => {
let begindate = new Date(r['begindate']);
begindate.setDate(begindate.getDate() + 1);
let begindate = new Date(`${r['begindate']} 00:00:00`);
const diff = begindate.getTime() - now.getTime();
r.days_until_opening = Math.round(diff/86400000);
r.begindate_long = begindate.toLocaleDateString('en-US', {weekday: 'long', year: "numeric", month: "long", day: "numeric",});
Expand Down

0 comments on commit 8595368

Please sign in to comment.