'get the percentage difference passed

I need to get the distance value as a percentage so that I can use it in progress bar. I have already tried to divide and multiply and subtract everything among themselves, but nothing comes out.

;
(function() {
  const second = 1000,
    minute = second * 60,
    hour = minute * 60,
    day = hour * 24

  let today = new Date(),
    yyyy = today.getFullYear(),
    end = '05/08/' + yyyy,
    start = '05/07/' + yyyy

  const countDown = new Date(end).getTime()
  const countStart = new Date(start).getTime(),
    x = setInterval(function() {
      const now = new Date().getTime(),
        distance = countDown - now

      let hh = Math.floor((distance % day) / hour)
      let mm = Math.floor((distance % hour) / minute)
      let ss = Math.floor((distance % minute) / second)

      if (hh < 10) hh = '0' + hh
      if (mm < 10) mm = '0' + mm
      if (ss < 10) ss = '0' + ss

      document.querySelector('#days').innerText = Math.floor(distance / day)
      document.querySelector('#hours').innerText = hh + ':'
      document.querySelector('#minutes').innerText = mm + ':'
      document.querySelector('#seconds').innerText = ss

      const progress = ((now - countStart) / (countDown - countStart)) * 100 + '%'
      document.querySelector('.text').innerText = progress

      if (distance < 0) {
        clearInterval(x)
      }
    }, 0)
})()
<div class="timer" id="timer">
  <div class="timer__container">
    <span class="timer__itm timer__days" id="days"></span><span class="timer__text">дн</span>
    <span class="timer__itm timer__hours" id="hours"></span>
    <span class="timer__itm timer__minutes" id="minutes"></span>
    <span class="timer__itm timer__seconds" id="seconds"></span>
  </div>
</div>
<div class="text"></div>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source