sort date groups properly