Closed felixruponen closed 8 years ago
I added a string empty check for attrs.min/attrs.max since I am using something like:
<input ng-model="date" datetime="yyyy:MM:dd" min="{{ minDate | date:'yyyy:MM:dd' }}" />
If minDate is undefined (min="") angular-datetime will still compare the ngModel against new Date(attrs.min) which will evaluate to new Date('') which is of course an invalid date. This means the input will always be invalid.
:+1: Maybe we can just replace angular.isUndefined(attrs.min) with ngModel.$isEmpty(attrs.min)?
angular.isUndefined(attrs.min)
ngModel.$isEmpty(attrs.min)
Sounds good, looks a lot better! I have updated the PR.
I added a string empty check for attrs.min/attrs.max since I am using something like:
<input ng-model="date" datetime="yyyy:MM:dd" min="{{ minDate | date:'yyyy:MM:dd' }}" />
If minDate is undefined (min="") angular-datetime will still compare the ngModel against new Date(attrs.min) which will evaluate to new Date('') which is of course an invalid date. This means the input will always be invalid.