This is how I create my datepicker field:
$formBuilder->add('getTimestamp', DateType::class, array(
'widget' => 'single_text',
'format' => 'yyyy-MM-dd',
'data' => new \DateTime(),
'attr' => array('class' => 'form-control', 'style' => 'line-height: 20px;'), 'label' => $field['fieldName'],
));
When I change the format...
$formBuilder->add('getTimestamp', DateType::class, array(
'widget' => 'single_text',
'format' => 'dd.MM.yyyy',
'attr' => array('class' => 'form-control', 'style' => 'line-height: 20px;'), 'label' => $field['fieldName'],
));
... the date is formatted correctly, but the datepicker ist not working anymore.
Take a look at this: Is there any way to change input type="date" format?
Mainly, there is a difference between "Over the wire" and "Presentation" format. In your case, the format you are configuring is "Over the wire". You should probably look at specifying a "Presentation" format in your front-end (e.g. the HTML date input, or jquery UI plugin, etc.