I user ion-datetime plugin.
All worked fine, till I tried to pass value to ‘max’ param.
I limit the date picker to 18 years ago.
The result is that when user open the datepicker, he see only years and days lists, if he want to select month - he need to ‘pull’ the month-list by scrolling.
Here is my code:
HTML:
<ion-datetime displayFormat="MMM DD, YYYY" [(ngModel)]="user.dob" [formControl]="birthdate" monthShortNames="{{'monthes' | translate}}"
[max]="maxDob"></ion-datetime>
TypeScript:
export class SignUp2Page {
maxDob: string;
signUpProfileForm: FormGroup;
birthdate: AbstractControl;
constructor(public fb: FormBuilder) { }
ngOnInit() {
var self = this;
self.signUpProfileForm= self.fb.group({
'birthdate': [],
});
self.maxDob = new Date(new Date().setFullYear(new Date().getFullYear() - 18)).toISOString();
}
Link to image: