diff --git a/rpr222/index.html b/rpr222/index.html index f783992..13ecb11 100644 --- a/rpr222/index.html +++ b/rpr222/index.html @@ -44,8 +44,8 @@
Event | Time | Time Until | "; if (eventsLength > 15) { @@ -143,7 +143,7 @@ function main(array, dataLoad, aLen) { isEventsArray = Array.isArray(events); eventsLength = aLen; - console.log(`inside main`); +// console.log(`inside main`); console.log(`events = ${events}`); console.log(`dataLoad = ${dataLoad}`); console.log(`${isEventsArray}`); @@ -160,7 +160,7 @@ function main(array, dataLoad, aLen) { currentStart = currentDate; currentEnd = nextDate; nextStart = nextDate; - nextEnd = events[(nextObject + 1)].date; + nextEnd = events[(nextObject)].date; currentSubject = events[currentObject].subject; nextSubject = events[nextObject].subject; @@ -183,6 +183,42 @@ console.log(`nextDate = ${nextDate}`); // Update the count down every 1 second var x = setInterval(function() { + window.stopwatch++; + stopwatch = window.stopwatch; + +// console.log(stopwatch); + + swDays = Math.floor(stopwatch / (60 * 60 * 24)); + swHours = Math.floor((stopwatch % (60 * 60 * 24)) / (1000 * 60 * 60)); + swSeconds = Math.floor(stopwatch % (60)); + swMinutes = Math.floor(stopwatch / 60); +// swMinutes = Math.floor((nextDistance % (1000 * 60 * 60)) / (1000 * 60)); + if (swDays === 0) { + var swd = ''; + } else { + var swd = swDays + 'Days '; + } + + if (swHours < 10) { + var swh = '0' + swHours; + } else { + var swh = swHours; + } + + if (swMinutes < 10) { + var swm = '0' + swMinutes; + } else { + var swm = swMinutes; + } + + if (swSeconds < 10) { + var sws = '0' + swSeconds; + } else { + var sws = swSeconds; + } + + document.getElementById("stopwatch").innerHTML = swDays + swHours + ":" + swMinutes + ":" + swSeconds; + document.getElementById("meta").innerHTML = "Version: " + version + "
---|