Skip to content

[Form] Date field in Form type shows the wrong date #3673

@fariazz

Description

@fariazz

I have a form type which has a field of type "date" defined like in the documentation:

->add('startdate','date',array('label' => 'basics.period.startdate', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd'))

If I save a new entity with this form, the date stored to the DB is correct.

But if I edit the entity, the pre-filled date value in the date field is 1 day behind.

For example:
-date in the database: 2012-03-18

-date shown in the date field in the form: 2012-03-17

-date if I ouput directly from php ( echo $entity->getStartdate()->format('Y-m-d'); ) : 2012-03-18

I think this could be a bug of the date type. I've posted more info here:

http://forum.symfony-project.org/viewtopic.php?uid=21122&f=23&t=40472&start=0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions