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
The easiest way to sort on a date in the Material Table is converting your date to a Unix timestamp in the sortingDateAccessor
.
this.dataSource.sortingDataAccessor = (item, property) => {
switch (property) {
case 'birthday':
return new Date(item.birthday).getTime()
default:
return item[property]
}
}