startDate and endDate are correctly calculated