In .html file i have this:
<ion-datetime [(ngModel)]="mydate1" [(ngModel)]="defaultDate" ></ion-datetime>
And in .ts:
defaultDate: String = new Date().toISOString();
This will now, after loading, set the default time of the ionic datetime to todays date, but i want the solution where the date gets set -7 days from todays date.
Is the only solution here to cut the String, get the todays date into an integer, compute it, write it back to string type and merge it into a new String, that will be set into the ion-datetime?
Looking for ideas/other possible solutions here.
As Pierre said, the solution is defautlDate = (new Date(new Date().getTime() – (7 * 24 * 60 * 60 * 1000))).toISOString();