You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
If passing a \DateTimeInterface value to DateValidator and DateTimeValidator, by default it treats it as invalid.
This is ironic since DateTimeValidator actually uses the fact an instance of \DateTime was successfully created as a signal the value is valid.
How to reproduce
Pass a valid instance of \DateTimeInterface to either DateValidator or \DateTimeValidator, they will validate it as invalid.
Possible Solution
Allow \DateTimeInterface values as valid.
Additional context
Using some tools to read Excel files already converts the values in cells to \DateTimeInterface instances (based on Excel cell value format hints). Passing the to the validation process fails it since it's not a string.
The text was updated successfully, but these errors were encountered:
dkarlovi
changed the title
DateValidator, DateTimeValidator should accept \DateTimeInterface
[Validator] DateValidator, DateTimeValidator should accept \DateTimeInterface
Aug 24, 2021
Symfony version(s) affected: 5.3.6
Description
If passing a
\DateTimeInterface
value toDateValidator
andDateTimeValidator
, by default it treats it as invalid.This is ironic since
DateTimeValidator
actually uses the fact an instance of\DateTime
was successfully created as a signal the value is valid.How to reproduce
Pass a valid instance of
\DateTimeInterface
to eitherDateValidator
or\DateTimeValidator
, they will validate it as invalid.Possible Solution
Allow
\DateTimeInterface
values as valid.Additional context
Using some tools to read Excel files already converts the values in cells to
\DateTimeInterface
instances (based on Excel cell value format hints). Passing the to the validation process fails it since it's not a string.The text was updated successfully, but these errors were encountered: