Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Form] Passing a reference date causes the DateTimeToArrayTransformer to set minutes/hours when the stored value is 0 #40999

Copy link
Copy link
Closed
@KDederichs

Description

@KDederichs
Issue body actions

Symfony version(s) affected: 5.2.6 (probably others)

Description
If you pass a reference time to a TimeType field with input type array it will assume the time properties of the reference date when the field value was 0

How to reproduce

  1. Get a TimeType form field
  2. Set input to array
  3. Add a reference_date
  4. Try to set it to 0

Possible Solution
It's caused by https://github.com/symfony/form/blob/8822890bdb6267f8d1c027f697db4bd83c2afc55/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php#L170 cause empty views 0 as empty value and will thus take the value of the reference date

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

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.