Today I uses input type=“date”, when I add “max” attribute e.g. max=“2015-06-25”, if I the viewValue was “2015-06-25” , the modelValue always was undefined.
But in https://docs.angularjs.org/api/ng/input/input%5Bdate%5D when set max=“2013-12-31” , if viewValue is “2013-12-31” the modelValue is a date object not undefined.
I think if we have set max=“2015-06-25” when the viewValue is “2015-06-25” the modelValue should be a date object of “2015-06-25” , does any has occurred this problem???
my code:
<ion-content>
<form name="myForm" class="item">
<input type="date" ng-model="date" max="{{maxDateStr}}" name="dateInput">
<p> time: {{date}}</p>
<p>myForm.$valid : {{myForm.$valid}}</p>
<p>myForm.dateInput.$error.max : {{myForm.dateInput.$error.max}}</p>
</div>
</ion-content>
js code
angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope, $filter) {
$scope.maxDateStr = $filter('date')(new Date(), 'yyyy-MM-dd');
$scope.date = new Date();
});