implemented calculation of startDate and enddate for a week
refactoring