title: UI-bootstrap datepicker ng-model $scope data not correct in controller
body: <p>I'm trying to use UI bootstraps datepicker to let a user select a date. The selected information I asume is stored in the ng-model <strong>$scope.enddate</strong> variable. After a date is picked, the correct information is displayed in the browser debugging section above. </p>
  
  <p><strong>view</strong></p>
  
  <pre><code>&lt;pre&gt;
          ----------
          Debugging:
          {$ modelStartdate $}
          {$ !!partners.length $}
  
          Chosen stardate: The {$ startdate.getDate() $} of {$ startdate.getMonth() $}
          Chosen End-date: The {$ enddate.getDate() $} of {$ enddate.getMonth() $}
          Chosen Current year {$ enddate.getFullYear() $}
      &lt;/pre&gt;
      &lt;input            ng-click="openStartEndPicker($event, 'secondCal')"
                        type="text"
                        class="form-control"
                        datepicker-popup="yyyy/MM/dd"
                        ng-model="enddate"
                        is-open="modelEnddate.secondCal"
                        name="secondCal"
                        max-date="'2015-06-22'"
                        datepicker-options="dateOptions"
                        date-disabled="disabled(date, mode)"
                        ng-required="true"
                        close-text="Close"
                        datepicker-mode="month"/&gt;
  
   &lt;button ng-click="findNotLinkedPartners()" type="submit" class="btn btn-info"&gt;
            &lt;span&gt;&lt;i class="glyphicon glyphicon-repeat"&gt; Validate&lt;/i&gt;&lt;/span&gt;
           &lt;/button&gt;
  </code></pre>
  
  <p>On an ng-click event, I want to use this data to make a post request. 
  But I always get the default information 2015 - 4 in the console??</p>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>//Datepicker (selfenvoicing)
          $scope.startdate ='';
          $scope.enddate ='';
  
          //Set start end end date based on current day
          $scope.initDates = function() {
              var date = new Date();
              $scope.startdate = new Date(date.getFullYear(), date.getMonth(), 1);
              $scope.enddate  = new Date(date.getFullYear(), date.getMonth() + 1, 0);
  
              //Do initial partner validatioin with this year/month information (selve invoiking function)
          }();
  
          //In-calender functions/options
          $scope.today = function() {
              $scope.dt = new Date();
          }();
  
          $scope.toggleWeeks = function () {
              $scope.showWeeks = ! $scope.showWeeks;
          };
          $scope.clear = function () {
              $scope.dt = null;
          };
          $scope.toggleMin = function() {
              $scope.minDate = ( $scope.minDate ) ? null : new Date();
          }();
          $scope.dateOptions = {
              'year-format': "'yy'",
              'starting-day': 1
          };
  
          //trick to prevent not opening calender next time
          $scope.modelEnddate = {};
  
          $scope.openStartEndPicker = function($event, elementOpened) {
              $event.preventDefault();
              $event.stopPropagation();
  
              $scope.modelEnddate[elementOpened] = !$scope.modelEnddate[elementOpened];
          };
  </code></pre>
  
  <p>Function to be called:</p>
  
  <pre><code>$scope.findNotLinkedPartners = function() {
  
            console.log($scope.enddate.getFullYear() + " - " + $scope.enddate.getMonth());
    // POST request here
  }; 
  </code></pre>