minor #4685 Add note to format_datetime explaining how to install required extensions (LucileDT)

This PR was merged into the 3.x branch.

Discussion
----------

Add note to format_datetime explaining how to install required extensions

Commits
-------

d0177b94cd Add note to format_datetime explaining how to install required extensions
This commit is contained in:
Fabien Potencier
2025-08-25 21:44:53 +02:00
+23
View File
@@ -8,6 +8,29 @@ The ``format_datetime`` filter formats a date time:
{# Aug 7, 2019, 11:39:12 PM #}
{{ '2019-08-07 23:39:12'|format_datetime() }}
.. note::
The ``format_datetime`` filter is part of the ``IntlExtension`` which is not
installed by default. Install it first:
.. code-block:: bash
$ composer require twig/intl-extra
Then, on Symfony projects, install the ``twig/extra-bundle``:
.. code-block:: bash
$ composer require twig/extra-bundle
Otherwise, add the extension explicitly on the Twig environment::
use Twig\Extra\Intl\IntlExtension;
$twig = new \Twig\Environment(...);
$twig->addExtension(new IntlExtension());
Format
------