title: Why is my input type date value not set using Angular?
body: <p>I have this HTML:</p>
  
  <pre><code>&lt;input type="date" date="MM-dd-yyyy" required data-ng-model="customerFormData.customer.BirthDate" /&gt;
  </code></pre>
  
  <p>And this is my directive (<a href="http://jsfiddle.net/pkozlowski_opensource/Te3Mr/19/" rel="nofollow">from this fiddle of P. Kozlowski</a>)</p>
  
  <pre><code>app.directive('date', function (dateFilter) {
      return {
          require: 'ngModel',
          link: function (scope, elm, attrs, ctrl) {
              debugger;
              var dateFormat = attrs['date'] || 'yyyy-MM-dd';
              var minDate = Date.parse(attrs['min']) || 0;
              var maxDate = Date.parse(attrs['max']) || 9007199254740992;
  
              ctrl.$parsers.unshift(function (viewValue) {
                  var parsedDateMilissec = Date.parse(viewValue);
                  if (parsedDateMilissec &gt; 0) {
                      if (parsedDateMilissec &gt;= minDate &amp;&amp; parsedDateMilissec &lt;= maxDate) {
                          ctrl.$setValidity('date', true);
                          return parsedDateMilissec;
                      }
                  }
  
                  // in all other cases it is invalid, return undefined (no model update)
                  ctrl.$setValidity('date', false);
                  return undefined;
              });
  
              ctrl.$formatters.unshift(function (modelValue) {
                  return dateFilter(modelValue, dateFormat);
              });
          }
      };
  });
  </code></pre>
  
  <p>But my date field doesn't get a value, it keeps saying <code>dd-mm-jjjj</code> (Duth notation).</p>
  
  <p>I set the value of <code>customerFormData.customer.BirthDate</code> in the code to <code>new Date().getTime();</code> to test this, but like I said, it doesn't work.</p>
  
  <p>What I want to achieve is that a <code>input type date</code> is bind to my date fields.</p>