Symfony - Twig - Filter "localizeddate" doesn't work on DateTime

I found the solution.

You should have the twig intl extension installed. if not, do composer require twig/extensions

You may activate the services in config.yml or services.yml file like that:

services:
    twig.extension.intl:
        class: Twig_Extensions_Extension_Intl
        tags:
            - { name: twig.extension }

i use a new twig filter format_date() : https://twig.symfony.com/doc/2.x/filters/format_date.html

  1. Install: composer req twig/intl-extra
  2. Usages in twig:
created_at|format_date('full')
created_at|format_date('full', '', null, 'gregorian', 'fr')
created_at|format_date('none', 'MMMM Y', null, 'gregorian', 'fr')

Tags:

Twig

Symfony