So I am trying to display this date for an input. But it\'s not displaying when setting the value of it in my form builder group. I would also like to be able to format it too.<
Another solution, a little more functional w time zone Offset, adding binding and format transformation:
.html:
.ts:
actualDateFormGroup = new Date(new Date().getTime() - (new Date().getTimezoneOffset() * 60000)).toISOString().split("T")[0];
onMyDateChange(event: any) {
this.forma.patchValue({ myDate: event.target.value });
}
Then you can modify the format obtained in the myDate variable as needed in the code.
For example: 2019-10-13 to 20191013
stringFormat(string){
let date = fechaString.replace(/-/g, '');
return date;
}
finalDate = stringFormat(myDate);