title: Bootstrap datepicker not close automatically after picking a date
body: <p>I use the latest Bootstrap datepicker.js. All works fine except that when I pick a date from the drop down, it does not automatically close it. I searched web and tried to use the following function in my javascript like the following: </p>
  
  <pre><code> $('#selectDate').datepicker({
      autoclose: true
  }).on('changeDate', function (ev) {
      (ev.viewMode == 'days') ? $(this).datepicker('hide') : '';      
  });
  </code></pre>
  
  <p>but when i use Google Chrome Dev tools, I realized that ev.viewmode was undefined. I am not sure how to move forward. </p>