Can anyone help me in discovering what is wrong?
When you look up this part of the stack trace:
t() (Line: 81)
Drupal\date_range_formatter\Plugin\Field\FieldFormatter\DateRangeFormatterRangeFormatter->viewElements() (Line: 89)
you find the error in these lines of the contrib module Date range formatter:
$single_format = $this->getSetting('single');
$elements[$delta] = ['#markup' => \Drupal::service('date.formatter')
->format($start_date, 'custom', t($single_format))];
The problem is a missing setting single
, probably a date format string you have to set in the field display settings. If you can't find it in UI then export the config and check the YAML files of the content type where this field is configured.
... and what needs to be fixed?
It seems like this is already fixed in the modules issue queue. Try this patch:
diff --git a/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php b/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php
index 798ce2b..6635ac8 100644
--- a/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php
+++ b/src/Plugin/Field/FieldFormatter/DateRangeFormatterRangeFormatter.php
@@ -77,7 +77,7 @@ class DateRangeFormatterRangeFormatter extends DateTimeCustomFormatter {
}
if (!array_key_exists($delta, $elements)) {
// No end date provided or end date equals start date use single formatting.
- $single_format = $this->getSetting('single');
+ $single_format = $this->getSetting('one_day');
$elements[$delta] = ['#markup' => \Drupal::service('date.formatter')->format($start_date, 'custom', t($single_format))];
}
}
https://www.drupal.org/project/date_range_formatter/issues/3309324#comment-14755079