typescript sort array by date code example
Example 1: sort array by date typescript
array.sort((x, y) => +new Date(x.createdAt) - +new Date(y.createdAt));
Example 2: javascript order array by date
const sortedActivities = activities.sort((a, b) => b.date - a.date)