diff --git a/core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeWidgetBase.php b/core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeWidgetBase.php index e99374c..849b440 100644 --- a/core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeWidgetBase.php +++ b/core/modules/datetime_range/src/Plugin/Field/FieldWidget/DateRangeWidgetBase.php @@ -136,7 +136,7 @@ public function validateStartEnd(array &$element, FormStateInterface $form_state if ($start_date->getTimestamp() !== $end_date->getTimestamp()) { $interval = $start_date->diff($end_date); if ($interval->invert === 1) { - $form_state->setError($element, $this->t('The @title end date cannot be before the start date', ['@title' => $element['#title']])); + $form_state->setError($element, $this->t('The end of %title cannot be before its start.', ['%title' => $element['#title']])); } } } diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php index e7f0fbb..e0ad886 100644 --- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php +++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php @@ -1304,7 +1304,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '12:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End date before start date has been caught.'); + $this->assertText(new FormattableMarkup('The end of %title cannot be before its start.', ['%title' => $field_label]), 'End date before start date has been caught.'); $edit = [ "{$field_name}[0][value][date]" => '2012-12-01', @@ -1313,7 +1313,7 @@ public function testInvalidField() { "{$field_name}[0][end_value][time]" => '11:00:00', ]; $this->drupalPostForm(NULL, $edit, t('Save')); - $this->assertText(new FormattableMarkup('The @title end date cannot be before the start date', ['@title' => $field_label]), 'End time before start time has been caught.'); + $this->assertText(new FormattableMarkup('The end of %title cannot be before its start.', ['%title' => $field_label]), 'End time before start time has been caught.'); } /**