From 3714afe26a0de4fa305f28d2136ce187bbfcf00b Mon Sep 17 00:00:00 2001 From: Kameron Kenny Date: Thu, 30 May 2019 11:43:04 -0400 Subject: [PATCH] fix --- broadcast_timer/events.js | 1 + broadcast_timer/main.js | 2 +- broadcast_timer/timerMath.js | 35 ++++++++++++++++------------------- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/broadcast_timer/events.js b/broadcast_timer/events.js index 87bac32..3b7dbbe 100644 --- a/broadcast_timer/events.js +++ b/broadcast_timer/events.js @@ -94,6 +94,7 @@ var events = [ "subject": "Andy's Sheet for CapAdd", "notes": "" }, + { "date": "May 30, 2019 14:30:00", "subject": "TD's for JS vuln", "notes": "https://github.exacttarget.com/tholt/jvmversions results repo" diff --git a/broadcast_timer/main.js b/broadcast_timer/main.js index 15825f7..48435e6 100644 --- a/broadcast_timer/main.js +++ b/broadcast_timer/main.js @@ -1,5 +1,5 @@ // meta -var version = "0.10.012" +var version = "0.10.013" var debug = false; diff --git a/broadcast_timer/timerMath.js b/broadcast_timer/timerMath.js index 26d14e2..26b8f9a 100755 --- a/broadcast_timer/timerMath.js +++ b/broadcast_timer/timerMath.js @@ -26,31 +26,12 @@ function countdown(targetDate, current) { minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60)); seconds = Math.floor((distance % (1000 * 60)) / 1000); -// Day or Days? - if (days > 0) { - if (days === 1){ - rDays = (days + ' Day '); - } else { - rDays = (days + ' Days '); - } - } else { - rDays = ''; - } // set style for countdown based on remaining time style = "green"; // reset style if (current === "current") { style = 'current'; -/* if (nextDays < 1 && nextHours < 1) { - if (nextMinutes < 0) { - style = 'over'; - } else if (nextMinutes < 15) { - style = 'warn'; - } else { - style = 'green'; - } - } */ } else { if (days < 1 && hours < 1) { if (minutes < 0) { @@ -63,6 +44,22 @@ function countdown(targetDate, current) { } } + if (days < 0) { + days = (-days); + days--; + } + +// Day or Days? + if (days > 0) { + if (days === 1){ + rDays = (days + ' Day '); + } else { + rDays = (days + ' Days '); + } + } else { + rDays = ''; + } + // pad single digits with a '0' prefix // when time is out, start counting up by inverting if (hours < 0) {