title: How to render contextual difference between two timestamps in JavaScript?
body: <p>Let's say I've got two strings in JavaScript:</p>
  
  <pre><code>var date1 = '2008-10-03T20:24Z'
  var date2 = '2008-10-04T12:24Z'
  </code></pre>
  
  <p>How would I come to a result like so:</p>
  
  <pre><code>'4 weeks ago'
  </code></pre>
  
  <p>or</p>
  
  <pre><code>'in about 15 minutes'
  </code></pre>
  
  <p>(should support past and future).</p>
  
  <p>There are solutions out there for the past diffs, but I've yet to find one with support for future time diffs as well.</p>
  
  <p>These are the solutions I tried:</p>
  
  <p><a href="http://ejohn.org/blog/javascript-pretty-date/#postcomment" rel="nofollow noreferrer">John Resig's Pretty Date</a> and <a href="http://www.zachleat.com/web/2008/03/23/yet-another-pretty-date-javascript/" rel="nofollow noreferrer">Zach Leatherman's modification</a></p>
  
  <p>Bonus points for a jQuery solution.</p>