I am receiving from the API a datetime like this: 2021-03-21T22:00:00
Here is my component.ts
ELEMENT_DATA: ReservationList[];
displayedColumns: string[] = ['fullName', 'brand', 'model', 'rentalStartDate', 'rentalEndDate', 'pickUpLocation', 'dropOffLocation', 'totalPrice', 'createdOn'];
dataSource = new MatTableDataSource<ReservationList>(this.ELEMENT_DATA);
//here the data is taken from the API call
public getAll() {
let resp = this.service.reservationList();
resp.subscribe(report => this.dataSource.data= report as ReservationList[])
}
In the HTML the date is displayed like this:
<ng-container matColumnDef="rentalEndDate">
<th mat-header-cell *matHeaderCellDef mat-sort-header> RentalEndDate </th>
<td mat-cell *matCellDef="let element"> {{element.rentalEndDate}} </td>
</ng-container>
And in the table the date is displayed like this 2021-03-21T22:00:00
I want to have the date displayed without the T character and just the date.