diff --git a/routes/resources.rb b/routes/resources.rb index 5e3b7dab47dbd7350d1b6e12bcd5a892de4295ba..9759c3bd8590902e2335c46c193235e313695422 100644 --- a/routes/resources.rb +++ b/routes/resources.rb @@ -220,7 +220,16 @@ post '/:service_space_url_name/resources/:resource_id/reserve/?' do end if params.checked?('recurring') - recurs_until_date = Time.strptime(params[:recurs_until_date], '%m/%d/%Y').midnight.in_time_zone + begin + recurs_until_date = Time.strptime(params[:recurs_until_date], '%m/%d/%Y').midnight.in_time_zone + rescue + recurs_until_date = nil + end + + if recurs_until_date.nil? || recurs_until_date - 365.days > Time.now || recurs_until_date < start_time.midnight.in_time_zone + flash :error, 'Invalid Recurs Until Date', 'Your recurs-until date must be less than a year in the future.' + redirect back + end # use the recurring type to increment the date here starts = []