title: Get the number of remaning Months, weeks and days inside JavaScript
body: <p>I want to write a JavaScript function, which will compare 2 date values (startdate &amp; now) and then show:-</p>
  
  <ol>
  <li><p>the remaining months &amp; weeks.</p></li>
  <li><p>if the  start date in with in the current month, to show the remaining weeks &amp; days.</p></li>
  <li><p>if the start date is with in the current week, to show the renaming days.</p></li>
  </ol>
  
  <p>now I find this script :</p>
  
  <pre><code>var nurl = items[i].CounterStartDate.toString();
  var countDownDate = new Date(nurl).getTime();
  
  
  var now = new Date().getTime();
  
  // Find the distance between now an the count down date
  var distance = countDownDate - now;
  
  // Time calculations for days, hours, minutes and seconds
  var days = Math.floor(distance / (1000 * 60 * 60 * 24));
  var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
  var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
  var seconds = Math.floor((distance % (1000 * 60)) / 1000);
  </code></pre>
  
  <p>which will show the remaining days, hours, minutes and seconds. But I am not sure how I can modify it to match my above 3 points?</p>
  
  <p>Hint. i date values i am using comes from a rest api and it will have the following format <code>2019-05-24T23:00:00Z</code> or <code>2018-06-20T23:00:00Z</code>, etc..</p>