added sort by date (handles date and datetime)