Symfony - Twig - Filter “localizeddate” doesn't work on DateTime

后端 未结 2 1009
鱼传尺愫
鱼传尺愫 2021-01-04 11:31

I\'m using twig and when I apply the filter

{{tutoriel.dateCreation | localizeddate(\'medium\', \'none\') }} on my datetime, I have this error :

<
2条回答
  •  清酒与你
    2021-01-04 12:17

    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 }
    

提交回复
热议问题