Skip to content

Commit

Permalink
Merge pull request #329 from Krinkle/optim-date
Browse files Browse the repository at this point in the history
tracker: assign midnight with only one Date object
  • Loading branch information
LKaemmerling authored May 2, 2022
2 parents c817854 + ce56c4f commit 9154926
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions assets/src/js/tracker.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
img.setAttribute('aria-hidden', 'true');
img.src = url + stringifyObject(d);
img.addEventListener('load', function() {
let now = new Date();
let midnight = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 24, 0, 0);
let midnight = new Date();
midnight.setHours(24); midnight.setMinutes(0); midnight.setSeconds(0);

// update data in cookie
if( data.pagesViewed.indexOf(path) == -1 ) {
Expand Down

0 comments on commit 9154926

Please sign in to comment.