diff --git a/src/Controller/CalendarController.php b/src/Controller/CalendarController.php index c7fb5a0..f184246 100644 --- a/src/Controller/CalendarController.php +++ b/src/Controller/CalendarController.php @@ -68,15 +68,19 @@ class CalendarController extends ControllerBase { // Determine which day has been selected by the user. If the user has entered a url that specifies a day outside of the // allowable reservation window, then set the current day as the selected day. $yyyy_mmdd = $dates[0]['yyyymmdd']; + $day_selected = false; foreach ($dates as $day) { if ($day['selected']) { $yyyy_mmdd = $day['yyyymmdd']; + $day_selected = TRUE; } } if ($yyyy_mmdd == $dates[0]['yyyymmdd']) { $dates[0]['selected'] = TRUE; $dates[0]['today'] = TRUE; - \Drupal::messenger()->addWarning(t('You have chosen a date to far in the ' + } + if(!$day_selected) { + \Drupal::messenger()->addWarning(t('You have chosen a date to far in the ' . 'future. Please choose a date within 14 days of today. The Calendar' . ' view below has defaulted to todays date.')); }