My Date Pipe is not working in Angular. I only want to show as this format MM/dd/yyyy'. How can it be fixed?
Typescript:
this.testDate = new Date(this.singleUser.createDate);
console.log(this.testDate);
this.userForm = new FormGroup({
userName: new FormControl(this.singleUser.userName),
email: new FormControl(this.singleUser.email),
createDate: new FormControl(this.singleUser.createDate)
});
Console Log: Wed Jul 22 2020 17:18:24 GMT-0700 (Pacific Daylight Time)
HTML:
<mat-form-field class="row" appearance="outline" floatLabel="always">
<mat-label>Created Date</mat-label>
<input matInput [readonly]="true" formControlName="createDate" [value] = "testDate | date: 'MM/dd/yyyy'" >
</mat-form-field>
Date is not showing as MM/dd/yyyy and has additional datetime hours seconds, etc