title: Bootstrap datepicker add duration to End Date issue when using variable value
body: <p>I have the following code. It's working fine if I use some values but when I passing value from variable(var duration) its showing wrong result.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('#startdate, #enddate').datepicker({
    format: 'yyyy-mm-dd',
    autoclose: true,
  });
  
  $('#duration').change(function() {
    var date2 = $('#startdate').datepicker('getDate');
    var duration = $(this).val();
    //alert(duration);
    date2 = new Date(date2);
    date2.setMonth(date2.getMonth() + duration);
    $('#enddate').datepicker('setDate', date2);
  
  });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" /&gt;
  &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.1/js/bootstrap-datepicker.min.js"&gt;&lt;/script&gt;
  &lt;link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.1/css/bootstrap-datepicker.css" rel="stylesheet" /&gt;
  &lt;input class="form-control" type="date" name="startdate" id="startdate"&gt;
  &lt;select name="duration" id="duration"&gt;
    &lt;option&gt;Select month&lt;/option&gt;
    &lt;option value="1"&gt;1&lt;/option&gt;
    &lt;option value="3"&gt;3&lt;/option&gt;
    &lt;option value="6"&gt;6&lt;/option&gt;
    &lt;option value="12"&gt;12&lt;/option&gt;
    &lt;option value="24"&gt;24&lt;/option&gt;
    &lt;option value="36"&gt;36&lt;/option&gt;
  &lt;/select&gt;
  &lt;input class="form-control" type="date" name="enddate" id="enddate"&gt;
  
  
     </code></pre>
  </div>
  </div>
  </p>