Skip to content

strange behaviour of format in DateTimeType::Class with widget single text #20031

Closed
@frian

Description

@frian

Hi,

I recently had a strange bug on a project, which disappeared after an ubuntu upgrade.

Yesterday it was back, no change in this part of the code, no sf update (3.1.4), ubuntu updates.

Same thing 2 hours difference. As @javiereguiluz mentionned it's the GMT offset.

I finally found it's the format option which causes this :

        ->add('startdate', DateTimeType::class, array(
                'widget' => 'single_text',
                'format' => 'dd/MM/yyyy HH:mm',
                'label'  => 'event.date.label',
                'attr'   => array('class'=>'date')
        ))

I also tried other formats like

    'format' => 'yyyy-MM-dd HH:mm'

with no change.

If I comment the format it works well.

I created some demo code here with 3.2 dev.

It reproduces the bug, but with one hour error instead of two in 3.1.4.

I also tried stuff like set timezone in AppKernel with no change.

Thanks !

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