add sortByDate functionality