- Issue created by @Anybody
- 🇩🇪Germany Anybody Porta Westfalica
The interesting thing is, that there even is a Drupal date format "html_date" on that page, so this can't be what's ment by this error?
- 🇩🇪Germany Anybody Porta Westfalica
Seems like this module conflicts with the Drupal core "format_date" twig filter from
new TwigFilter('format_date', [$this->dateFormatter, 'format']),Drupal\Core\Template\TwigExtension.
Houston we have a problem...
- 🇮🇳India arunkumark Coimbatore
@Anybody
I hope the issue is not with the Drupal core
format_date()twig extension. Till TWIG version 2.12 the format_date() is part of default. But on TWIG version >2.12 and 3.x version,format_date()extension is removed from the default and added into theIntlExtension. The IntlExtension needs to be installed separately to access the additional extensions.https://twig.symfony.com/doc/2.x/filters/format_date.html
https://twig.symfony.com/doc/3.x/filters/format_date.htmlIf Twig IntlExtension needs to work fine with Drupal core means, we can extend the
TwigExtension.phpfrom the path Drupal\Core\Template\TwigExtension.php.My reply about the patch on Drupal core available on this comment 🐛 Custom Core Twig Filter "format_date" conflicts with twig/intl-extra Active
https://www.drupal.org/project/drupal/issues/3419294#comment-15694037 🐛 Custom Core Twig Filter "format_date" conflicts with twig/intl-extra Active - 🇩🇪Germany gogowitsch
If you are using a custom theme, you can fix it by copying the template file
locale-translation-update-info.html.twigfrom core to the templates directory of your theme.Within the <li> tag, you can change the param of format_date, for example to this:
format_date('short'). This will circumvent the error.I have attached a patch file to make the necessary fix a little bit clearer. If you are using a theme managed by composer, then the "cweagans/composer-patches" plugin can prevent losing the manual change. Add these lines to your
composer.jsonfile, within the "extra" section:"patches": { "drupal/core": [{ "description": "https://www.drupal.org/project/twig_intl/issues/3419285", "url": "locale-translation-update-info.html.twig.patch" }] },Then, you can run
composer require cweagans/composer-patches:~2.0 && composer patches-relock && composer patches-repatch. - 🇬🇧United Kingdom d.fisher
Just an update on this. Drupal commerce has templates which use date_format. I resolved by copying the templates to my theme and changing the filter to format_date.