title: How can I calculate the difference in years, months and days between two dates in Javascript?
body: <p>How can I calculate the difference between two days telling me the remaining years remaining months and remaining days?</p>
  
  <p>Example:
  From: Oct 1 2013
  To: Nov 15 2013</p>
  
  <p>Output: 1 Month and 15 Days</p>
  
  <p>I've tried momentjs but it display the whole months and days, like 1 Month, 45 Days.
  I also tried this function but it displays the same thing:</p>
  
  <pre><code>var diff = Math.floor(end_date.getTime() - start_date.getTime());
  var day = 1000* 60 * 60 * 24;
  var days = Math.floor(diff/day);
  var months = Math.floor(days/31);
  var years = Math.floor(months/12);
  
  var message = days + " days " 
  message += months + " motnhs "
  </code></pre>