sorting by day logic