Sorting by date is finally working correctly