Reputation: 183
I am trying to set the "min" property of my ion-datetime to the current date according to the device using the mobile application.
Currently, this is the code in my ionic 3 project:
<ion-datetime displayFormat="DD/MM/YYYY" [min]="minimum"></ion-datetime>
I kind of get the idea that I have to bind my "min" property to a backend variable, but I'm not sure on how to do so.
PS: I'm a beginner in Ionic 3 so a link/detailed guidance would help alot.
Thank you.
Upvotes: 0
Views: 361
Reputation: 1943
You just need to create a variable in the component called minimum that holds the date you don't want to go below. For example (if you were using moment.js - just happened to have this code in front of me)
this.minimum = moment().subtract(3, 'months').format('YYYY-MM-DD');
or standard JS:
this.minimum = new Date(); // set whatever minimum you need
Upvotes: 1