title: Bootstrap datepicker set date to last day in month
body: <p>I'm working with the bootstrap datepicker found here <a href="http://www.eyecon.ro/bootstrap-datepicker/" rel="nofollow">http://www.eyecon.ro/bootstrap-datepicker/</a>  and I've limited it to minViewMode = months.  That part is working fine, but my problem is I need to take the selected date, find the number of days in the month they select, and return the last day of the month to the input field rather than the first day of the month.  Below is the code I've tried so far, but when I try to set the value of the date input field using the last line in the on('hide') function, it is not working, so I tried using the changeDate event and it still does not work.</p>
  
  <p>Does anyone know how I can set the value manually once a month has been selected?</p>
  
  <pre><code>var ending_month = $('#dpEND').datepicker(
          {
              format: "mm/dd/yyyy",
              viewMode: "years",
              minViewMode: "months"
          })
              .on('changeDate',function(ev)
              {
                  if(ev.viewMode=='months')
                  {
                      var endingDate = new Date(ev.date);
                      var endingMonth = endingDate.getMonth();
                      var endingYear = endingDate.getFullYear();
                      var endingDay = getDaysInMonth(endingMonth, endingYear);
                      endingDate = new Date(endingYear,endingMonth,endingDay);
                      ending_month.setValue(endingDate);
                      $('#dpEND').datepicker('hide');                     
                  }
              });
  </code></pre>
  
  <p>I keep getting an error in the console stating that object ending_month does not have a method setValue, althought the docs say it does.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've got it working.  I needed to use <code>$('#dpEND').datepicker('setValue',value);</code> instead of <code>ending_month.setValue();</code></p>