title: Calculating how much time has lapsed in % javascript
body: <p>Good evening!</p>
  
  <p>I just started messing around with JavaScript, and I am trying to do some calculations, but i am not sure how to do that.</p>
  
  <p>So in my test project, I am grabbing string of EPG (ElectronicProgramGuide) of tv channel.<br>
  This string has start and end time of show + minutes how long show will be still on.</p>
  
  <p>For example:  </p>
  
  <blockquote>
    <p>NOW: [<strong>21:00</strong> - <strong>22:45</strong>] +<strong>25</strong> min Star Wars</p>
  </blockquote>
  
  <p>So this string tells us that at moment Star Wars is on, it started at 21:00 and ends at 22:45, it also shows that there is 25 minutes until it ends.</p>
  
  <p>For outcome I am trying to create a progress bar of show status of show length.</p>
  
  <p>In HTML I only have 1 div, where I output <code>&lt;meter&gt;</code> after calculations are made:</p>
  
  <pre><code>&lt;div id="epgMeter"&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>So here's what I have so far, I have extracted all needed values from string.
  But as for further progress I am not sure how to do the math best.</p>
  
  <pre><code>var epgdata = "NOW: [15:00 - 16:00] +30 min Some Show";
  
  //GET SHOW START AND END TIME
  var startEnd = epgdata.split("[");
  var startEnd = startEnd[1].split("]");
  var stillToGo = startEnd[1].split(" min");
  var startEnd = startEnd[0].split(" - ");
  
  var stillToGo = stillToGo[0].replace('+', ''); //30
  var showStart = startEnd[0]; //15:00
  var showEnd = startEnd[1]; //16:00
  
  
  //SOME MATH MAGIC SHOULD HAPPEN HERE SO THE OUTCOME WOULD BE 50% IN CURRENT CASE
  
  var precentageOfshowLapsed = "50"; //JUST FOR TESTING
  
  document.getElementById("epgMeter").innerHTML='&lt;meter value="'+precentageOfshowLapsed+'" min="0" max="100"&gt;&lt;/meter&gt;';
  </code></pre>
  
  <p>EDIT: We should not use current time, because timezones may differ.</p>