I\'m working with Angular 2 and I have this code:
JS, this code initiates the employee-variable for the template:
handleEmployee(employee : Employee)
Fixed it with this code:
handleEmployee(employee : Employee){
this.employee = employee;
let dateString : string = employee.startDate.toString();
let days : number = parseInt(dateString.substring(8, 10));
let months : number = parseInt(dateString.substring(5, 7));
let years : number = parseInt(dateString.substring(0, 5));
let goodDate : Date = new Date(years + "/" + months + "/" + days);
goodDate.setDate(goodDate.getDate() + 2);
this.date = goodDate.toISOString().substring(0, 10);
}
Html: