update the logic for start date and end date