-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Closed
Labels
EnhancementGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)TwigBundle
Description
The problem
When using Twig as a standalone project, you can define the date and number format as follows:
$twig = new Twig_Environment($loader);
$twig->getExtension('core')->setDateFormat('d/m/Y', '%d days');
When using Twig inside a Symfony application, you have to use code like this to define this setting:
$this->get('twig')->getExtension('core')->setDateFormat('d/m/Y', '%d days');
Even worse, some people recommend to create a request listener to set this setting.
In my opinion, having to create a listener, adding ugly code to my controllers and hurting application performance just to set the number or date format for my Twig templates is wrong.
The solution
TwigBundle should expose two new configuration options called number_format
and date_format
to simply configure these settings.
Metadata
Metadata
Assignees
Labels
EnhancementGood first issueIdeal for your first contribution! (some Symfony experience may be required)Ideal for your first contribution! (some Symfony experience may be required)TwigBundle