Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
frian opened this issue Sep 23, 2016 · 2 comments
Closed

Comments

@frian
Copy link

frian commented Sep 23, 2016

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 !

@mvrhov
Copy link

mvrhov commented Sep 23, 2016

Complete edit:
You are using too old version of a master. The one in your lock file is before #19879 was merged into the master.

@frian
Copy link
Author

frian commented Sep 23, 2016

hi @mvrhov,

you are right and also my new hero :)

Applied to 3.1.4 and works.

Thanks a lot !

@jakzal jakzal closed this as completed Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants