Commit 59c7a422 authored by nicola85's avatar nicola85

Show error message when invalid dates are entered on reservation form

parent 03c7dab0
......@@ -93,6 +93,11 @@ class AddReservationForm extends FormBase {
}
if ($dates_valid) {
if ($end_date < $start_date) {
$form_state->setErrorByName('end_date', $this->t('End date must be on or after the start date.'));
return;
}
if ($bee_settings['bookable_type'] == 'hourly') {
if ($node->get('field_use_open_hours')->value) {
$open_hours = $node->get('field_open_hours')->getValue();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment