Custom Core Twig Filter "format_date" conflicts with twig/intl-extra

Created on 5 February 2024, 5 months ago
Updated 10 July 2024, 3 days ago


Some twig functions are not part of Twig core, but come with twig/intl-extra, like:

To be able to use them, I created . This simply adds the composer dependency and adds the extension.

This works great, but then I ran into this issue: 🐛 Twig\Error\RuntimeError: The date format "html_date" does not exist Active and looking for the reason, I found a major issue in Drupal core:

new TwigFilter('format_date', [$this->dateFormatter, 'format']),

has a naming conflict with the Twig function:

Both are using the same name for the |format_date() filter.

Drupal should not overwrite Twigs naming, but (I guess for historic reasons) does.

It's not very widely used in core (, but might be used in contrib!

I have no idea how to solve this cleanly, but Drupal overwriting the Twig method is unexpected and should not be done.
I couldn't find other naming conflicts.

This makes it impossible to use Twig IntlExtension in general, as it produces these conflicts everywhere |format_date() filter is used.

Steps to reproduce

Register Twig IntlExtension as documented on or simply use the module for that
Visit a page where a template with |format_date() filter is used, for example /admin/reports/translations

Proposed resolution

Resolve the naming conflict by renaming the Drupal core twig filter "format_date" (which is a breaking change) so that the Twig method is not used twice or being overwritten.
Any other ideas?

Merge request link

Remaining tasks


User interface changes


API changes

Data model changes

Release notes snippet

🐛 Bug report



11.0 🔥


Last updated about 17 hours ago

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

Production build 0.69.0 2024