title: JavaScript - difference between two time strings
body: <p>I need to compare two different datetime strings (formed: <strong>YYYY-MM-DD'T'HH:mm</strong>).</p>
  
  <p>Here are the datetime strings:</p>
  
  <pre><code>var a = ("2017-05-02T10:45");
  var b = ("2017-05-02T12:15");
  </code></pre>
  
  <p>I've sliced the dates out of them so I only need the time (formed: <strong>HH:mm</strong>).</p>
  
  <pre><code>var now = a.slice(11, 16);
  var then = b.slice(11, 16);
  
  // now = 10:45
  // then = 12:15
  </code></pre>
  
  <p>Is there any way I could get the difference between these two times?</p>
  
  <p>Result should look like this:</p>
  
  <pre><code>1 hour 30 minutes
  </code></pre>
  
  <p>Also if the dates are different is there any easy solution to get the date difference too?</p>