title: calculate between expiration date and the current date then return the remaining days in javascript
body: <p>Good day, I want to calculate the remaining days between the expiration date and the current date but it seems that the return is not what I expected.</p>
  
  <pre><code>function expiryDate(date_string) {
  
      var date = date_string.split("/");
      var year = parseInt(date[2]);
      var day = parseInt(date[1]);
      var month = parseInt(date[0]);
  
  var expiration = new Date(month,day,year);
  
     var d = new Date();
  var curr_day = d.getDate();
  var curr_month = d.getMonth()+1;
  var curr_year = d.getFullYear();
  
  var current_date = new Date(curr_month, curr_day, curr_year);
  
  return (expiration - current_date) / (1000*60*60*24);
  }
  </code></pre>
  
  <p>the code above will return the correct remaining days if the dates are the same for example.. the current date string was <strong>05/01/2018</strong> and the expiration is also the same and it will return 0, but when i move the expiration date to 1 day like 05/02/2018 the return is 28 days which is not correct. </p>
  
  <p>How can I fix this problem?</p>