Hi,

You can specify the pattern to be used when building your form, but
there is not working at this time or you have to modify the Symfony
Core DateType field class, I've reported this bug here :
http://trac.symfony-project.org/ticket/9736

Infos over the DateType field reference : 
http://symfony.com/doc/2.0/reference...ypes/date.html

I give you the way I follow :

in your form builder :


<?php
$builder->add('madate','date',array(
'pattern'=>'d-M-Y' // here the separator is a -
);
?>


In the core DateType field class:

\vendor\symfony\src\Symfony\Component\Form\Extension\Core\Type
\DateType.php

Code to add after the $formatter in the beginning of the class, around
line 38 :



<?php
if(!is_null($options['pattern']))
{
$formatter->setPattern($options['pattern']);
}
?>


Don't forget that the pattern is based on the format option (by
default MEDIUM) - have a look at the IntlDateFormatter PHP Class :
http://php.net/manual/fr/class.intldateformatter.php

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to