Ionic 2 date picker min\max date

I want to set the date picker value in my component, so I’ve written this code but its not working (Cannot read property ‘month’ of null"):

HTML:
<ion-datetime
required
min="minDate"
max="maxDate"
name="targetDate"
displayFormat="MMM DD YYYY"
mode=“date”
[(ngModel)]=“swapDay.targetDate”>
</ion-datetime>

TS:
public minDate = “2016-01-01”;
public maxDate = “2017-01-01”;

I forgot to add {{}} in my HTML:

min={{minDate}}
max={{maxDate}}

1 Like

min={{your_controller_value}}
its working