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

DateTime passes validation in form collection when using DateTimeType with single_text #28455

Copy link
Copy link
Closed
@akalineskou

Description

@akalineskou
Issue body actions

Symfony version(s) affected: 4.1.4

Description
I have these 2 entities, Test and TestTest.
TestTest has 2 datetime fields, datetimeStart, and datetimeEnd, both @Assert\NotBlank() and @Assert\DateTime()
TestTest has a ManyToOne relation to Test.
TestType sets testTests as a collection of TestTestType and TestTestType has datetimeStart, and datetimeEnd both as 'widget' => 'single_text', 'date_format' => 'yyyy-MM-dd HH:mm:ss',

If we go to test_new (index redirects here) and submit the form without data we see that not blank works https://i.imgur.com/D8QZvCg.jpg

Reset the page, and set the datetimeStart (or end) to test, and it shows correctly that the value is not valid https://i.imgur.com/YKmhilM.jpg

Reset again and set the datetimeStart to a, m, y, x whatever character and it gets transformed to a date and passes validation https://i.imgur.com/uo7VvbW.jpg

I don't think this is intended behaviour... What I need it to do is DateTimeValidator should check for the value (x) in this example, and return an error that the format is not valid

How to reproduce
https://github.com/alex2005git/symfony_form_validator_datetime
Clone the repo, modify .env with the DATABASE_URL and database name symfony_form_validator_datetime and run composer initDB to create the table and update the schema

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.