title: I can't get the date from date input value to another var angularjs
body: <p>I have  a date input that for some reason keeps becoming undefined or " d- n- u" when I try to use in my scope variable. 
  Thought I have a watch for this input and the value is not undefined in there.
  I can't seem to get this to work</p>
  
  <p>html:</p>
  
  <pre><code>&lt;input type="date" id="date-input2" ng-model="params.schedule" /&gt;
  </code></pre>
  
  <p>javaScript:</p>
  
  <pre><code>$scope.$watch('params.schedule', function (newValue, oldValue) {
  //here I am indeed getting Mon Dec 31 2018 00:00:00 GMT+0000 (Western European //Standard Time)
          console.log(newValue);
          console.log($scope.params.schedule);
  
      }, true);
  </code></pre>
  
  <p>//but when I try to use it it becomes <code>undefined</code>... and then <code>d-n-u</code>...because of it</p>
  
  <pre><code>var scheduledDate = $scope.params.schedule;
  $scope.params.schedule = scheduledDate[2] + "- " + scheduledDate[1] + "- " + scheduledDate[0];
  $scope.ScheduledDate = scheduledDate.substring(0, 10);
  </code></pre>
  
  <p>why is the value getting lost midway?</p>