I\'m using angular material table and using matSort for sorting. But it\'s not sorting the dates/time column. It takes the datetime column values as strings.
How to sor
Here is solution:
this.dataSource.sortingDataAccessor = (item, property): string | number => { switch (property) { case 'fromDate': return new Date(item.fromDate).toNumber(); default: return item[property]; } };
MatTableDataSource has sortingDataAccessor which we can customize as per our need.