Zagloo Zagloo - 1 year ago 237
Twig Question

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

I'm using twig and when I apply the filter

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

The filter "localizeddate" does not exist in Video2LearnAdministrationBundle:VisualisationFicheTutoriel:fiche_tutoriel.html.twig at line 167

Where I'm wrong ?

Thanks :)

Answer Source

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:

        class: Twig_Extensions_Extension_Intl
            - { name: twig.extension }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download