I'm trying to use a datetime type
$builder->add('start_date', 'datetime', array(
'widget' => 'single_text',
'input' => 'string'
));
my form date format is RFC 3339
[start_date] => '2016-01-04T16:01:25+00:00'
Error
The parsed date was invalid, The separation symbol could not be found, Unexpected data found., Unexpected data found., Unexpected data found., Unexpected data found., Unexpected data found., Data missing
seems that datetime type is only expecting date as string with format 2016-01-04 16:01:25 and this format can't be changed from the form type configs
wondering if thats the desired behavior or an issue
Note
both format and date_format options will work on the view data rather than the input data.
stack trace
at DateTimeToStringTransformer ->reverseTransform ('2016-01-04T16:01:25+0000')
in vendor/symfony/symfony/src/Symfony/Component/Form/ReversedTransformer.php at line 46 +
at ReversedTransformer ->transform ('2016-01-04T16:01:25+0000')
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 1087 +
at Form ->modelToNorm ('2016-01-04T16:01:25+0000')
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 352 +
at Form ->setData ('2016-01-04T16:01:25+0000')
in vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php at line 57 +
at PropertyPathMapper ->mapDataToForms (array('start_date' => '2016-01-04T16:01:25+0000')), object(RecursiveIteratorIterator))
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 386 +
at Form ->setData (array('start_date' => '2016-01-04T16:01:25+0000'))
in vendor/symfony/symfony/src/Symfony/Component/Form/Form.php at line 478 +
at Form ->initialize ()
in vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php at line 226 +
at FormBuilder ->getForm ()
in vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php at line 40 +
at FormFactory ->create ('app_test_form', array('start_date' => '2016-01-04T16:01:25+0000')), 'items' => array()), array())
in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/Controller.php at line 282 +
at Controller ->createForm ('app_test_form', array('start_date' => '2016-01-04T16:01:25+0000')), 'items' => array()))
in src/AppBundle/Controller/DummyController.php at line 39 +
formatoption? Please note that the view data is both the data that is shown to the user as well as the data entered by the user. If you use your form in an API, the view data is the data sent by the consumer of your API.