Skip to content

Incorrect date result of DateTimeLocalizedStringTransformer #19721

@dkorsak

Description

@dkorsak

#19531

After merge issue above, there is bug on the DateTimeType::class form type - DateTimeToLocalizedStringTransformer class on branch master.

My timezone is Europe/Warsaw, +2h from UTC timezone.

Part of form:

$builder->add(
                'publishDateEnd',
                DateTimeType::class,
                [
                    'required' => false,
                    'widget' => 'single_text',
                    'format' => 'dd.MM.yyyy HH:mm',
                    'attr' => [
                        'placeholder' => 'dd.mm.yyyy HH:mm',
                    ],
                ]

When for example publishDateEnd is set as 2016-08-01 10:00:00 and I set in the web form date as 2016-08-01 12:00:00, after save form date back to 2016-08-01 10:00:00. Should be saved as 2016-08-01 12:00:00.

When I add 'view_timezone' => 'UTC' into widget option, date is display as correct date, but is invalid in database

My php.ini timezone is set as Europe/Warsaw

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