Zagloo Zagloo - 5 months ago 61
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 :)


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 }