- 🇮🇳India bapi_22
@here the patch is applying correctly with 4.0.2 version.
Uploading a clean patch
- Status changed to Needs review
about 1 year ago 1:23pm 22 December 2023 - 🇩🇪Germany tobiasb Berlin
fyi: The format single, single_all_day was removed via 🐛 Rename "Date range (without time)" formatter Fixed , the settings form for single, single_all_day was added again via 📌 t() calls should be avoided in classes Fixed .
- First commit to issue fork.
- Status changed to RTBC
12 months ago 12:02pm 27 December 2023 - 🇺🇦Ukraine taraskorpach Lutsk 🇺🇦
I've rebased the commits from the latest release.
The patch from #12 seems good to me; it has been applied, and the issue is resolved. Therefore, I'm marking this as RTBC.
I hope that the fix will be included in the next release, as it is quite critical.
- 🇺🇸United States NicholasS
So I just removed my patch for https://git.drupalcode.org/project/date_range_formatter/-/merge_requests... and then upgraded drupal/date_range_formatter (dev-9.0.x 8808a9c => dev-9.0.x d1f07a7).
And I am back to seeing a white screen on my site
The website encountered an unexpected error. Please try again later. InvalidArgumentException: $string ("") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 132 of core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php). Drupal\date_range_formatter\Plugin\Field\FieldFormatter\DateRangeFormatterRangeFormatter->t(NULL) (Line: 91) Drupal\date_range_formatter\Plugin\Field\FieldFormatter\DateRangeFormatterRangeFormatter->viewElements(Object, 'en') (Line: 89) Drupal\Core\Field\FormatterBase->view(Object, 'en') (Line: 265) Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) (Line: 268) Drupal\layout_builder\Entity\LayoutBuilderEntityViewDisplay->buildMultiple(Array) (Line: 257) Drupal\views\Entity\Render\EntityFieldRenderer->buildFields(Array) (Line: 143) Drupal\views\Entity\Render\EntityFieldRenderer->render(Object, Object) (Line: 838) Drupal\views\Plugin\views\field\EntityField->getItems(Object) (Line: 1189) Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object) (Line: 238) template_preprocess_views_view_field(Array, 'views_view_field', Array) call_user_func_array('template_preprocess_views_view_field', Array) (Line: 285) Drupal\Core\Theme\ThemeManager->render('views_view_field', Array) (Line: 445) Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204) Drupal\Core\Render\Renderer->render(Array) (Line: 1784) Drupal\views\Plugin\views\field\FieldPluginBase->theme(Object) (Line: 765) Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow(Array) call_user_func_array(Array, Array) (Line: 111) Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 797) Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 386) Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 204) Drupal\Core\Render\Renderer->render(Array) (Line: 704) Drupal\views\Plugin\views\style\StylePluginBase->renderFields(Array) (Line: 570) Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping(Array, Array, 1) (Line: 461) Drupal\views\Plugin\views\style\StylePluginBase->render(Array) (Line: 2181) Drupal\views\Plugin\views\display\DisplayPluginBase->render() (Line: 1548) Drupal\views\ViewExecutable->render() (Line: 131) Drupal\views\Plugin\views\display\Block->execute() (Line: 1645) Drupal\views\ViewExecutable->executeDisplay('block_3', Array) (Line: 81)
So is there some kind of missing database update or something? Do I need to change my views? I tried to resave the date fields but that didn't seem to work either.
- 🇺🇸United States NicholasS
Here is an xdebug screenshot if that helps debug, im not sure what needs fixed....
- 🇺🇸United States NicholasS
Here is another screenshot higher up the call stack
- @nicholass opened merge request.
- 🇺🇸United States NicholasS
Ok so I updated this forks branch with commits from the source, and re-applied the original change. So the new diff is https://git.drupalcode.org/project/date_range_formatter/-/merge_requests... and seems to work for me.
- 🇦🇺Australia nigelcunningham Geelong
Static version of MR for use in composer patching.
- 🇦🇹Austria paper boy
Patch from #12 resolves the issue for us on Drupal 10.2.2
- 🇨🇦Canada teknocat
These patches are not the correct solution to the problem. The issue is that "single" and "single_all_day" options were added to the settings form, but not defined in the schema YML or provided with the default options. They also weren't displayed in the summary.
I'll create another issue fork that makes those corrections.
- First commit to issue fork.
- 🇺🇸United States jeffam
I added the
3309324-single-day
branch to create a patch against the dev version of this module.Here's the URL for the patch from the one commit on that branch:
https://git.drupalcode.org/issue/date_range_formatter-3309324/-/commit/4...
This patch only works against the the 9.0.x dev version.
- 🇺🇸United States majorrobot
Can confirm this is also broken in 4.0.2.
However, the most recent fix (
3309324-single-day
) does the trick (at least for the dev version of the module). Would be great to get this merged in and released so we don't have to depend on the dev version! - 🇳🇱Netherlands pefferen
The patch in #30 works for us, we use version 4.0.2
It introduced another issue, if the start and end date and time are the same, the date is rendered incorrectly if the
one_day
time format is configured to include the start and end time as well. The module assumes that no end date is needed to render the date if the start and end timestamps are the same.
For this I created a new issue #3492241 🐛 Single date and time rendering incorrect Active - 🇺🇸United States sea2709 Texas
This patch is an improvement from the patch #30 🐛 Passing empty value to t() when same day + time for start and end date RTBC I see in the formatter configuration, we have 'single' and 'single_all_day' settings but we've never used it. So this patch removes these settings from the settings form.
- leymannx Berlin
#3309324-30: Passing empty value to t() when same day + time for start and end date → is working around the issue so far.
But I'm really confused why we pass a variable to
t()
in the first place. You should never uset()
to translate variables. - leymannx Berlin
This one needs work. We can't simply drop the
single
config. Because now dates without an end date will have no way to be configured. - leymannx Berlin
I think this is how it is supposed to be. Added
single
back and removedt()
around variables.