Skip to content

Commit

Permalink
fix: Cannot access 'prettyDiff' before initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
xxchan committed Aug 28, 2022
1 parent a8c1bc4 commit 7195bef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ function renderCountdown(el) {
const timePart = timeTextParts[2] && !isNaN(timeTextParts[2][0]) ? timeTextParts[2] : '';
const then = new Date(timeTextParts[0].concat(' ', timePart));

const prettyDiff = prettyDiff(then, now, cfgMinInterval);
if (prettyDiff === '') return;
time.textContent = `${timeText} (${then >= now ? 'in' : 'past'} ${prettyDiff})`;
const diff = prettyDiff(then, now, cfgMinInterval);
if (diff === '') return;
time.textContent = `${timeText} (${then >= now ? 'in' : 'past'} ${diff})`;
}

function tests() {
Expand Down

0 comments on commit 7195bef

Please sign in to comment.