Make compatible for optional end date (module Optional End Date and D11)

Created on 25 January 2025, 2 months ago

Problem/Motivation

Module doesn't work with module Optional End Date on D10. While when using field formatter "Add to Cal" results in no rendered button, using "Add to Cal Grouped Button" results in this error message on a white page:

TypeError: Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase::setTimeZone(): Argument #1 ($date) must be of type Drupal\Core\Datetime\DrupalDateTime, Drupal\optional_end_date\Plugin\Field\FieldType\OptionalEndDateDateRangeItem given, called in /var/www/html/web/modules/contrib/addtocal/src/Plugin/Field/FieldFormatter/AddtocalGroupedView.php on line 63 in Drupal\datetime\Plugin\Field\FieldFormatter\DateTimeFormatterBase->setTimeZone() (line 166 of core/modules/datetime/src/Plugin/Field/FieldFormatter/DateTimeFormatterBase.php).
Drupal\addtocal\Plugin\Field\FieldFormatter\AddtocalGroupedView->viewElements() (Line: 91)
Drupal\Core\Field\FormatterBase->view() (Line: 268)
Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple() (Line: 340)
Drupal\Core\Entity\EntityViewBuilder->buildComponents() (Line: 24)
Drupal\node\NodeViewBuilder->buildComponents() (Line: 282)
Drupal\Core\Entity\EntityViewBuilder->buildMultiple() (Line: 239)
Drupal\Core\Entity\EntityViewBuilder->build()
call_user_func_array() (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback() (Line: 870)
Drupal\Core\Render\Renderer->doCallback() (Line: 432)
Drupal\Core\Render\Renderer->doRender() (Line: 248)
Drupal\Core\Render\Renderer->render() (Line: 238)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 231)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare() (Line: 128)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse() (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray()
call_user_func() (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

It would be great to have this issue solved on D10. Since there will be an upgrade path from D10 optional end date in contrib module to optional end date in D11 core , the effort of fixing it for D10 will be beneficial for D11 as well.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇩🇪Germany adam1

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024