I have encountered an issue with my JavaScript function that sets min and max values for the input type date. While it works perfectly on Android devices, I am facing a problem on iPhone where I am unable to restrict the calendar with the specified min and max values.
Below is the snippet of my code:
JavaScript:
var today = new Date();
var maxAge = 18;
var minAge = 130;
vm.maxAge = new Date(today.getFullYear() - maxAge, today.getMonth(), today.getDate());
vm.minAge = new Date(today.getFullYear() - minAge, today.getMonth(), today.getDate());
HTML:
<input id="date" type="date" name="dateOfBirth" ng-model="dateOfBirth" placeholder="MM/DD/YYYY" ng-required="true" min="{{minAge | date:'yyyy-MM-dd'}}" max="{{maxAge | date:'yyyy-MM-dd'}}" />