[Validator][ConstraintValidator] Stop passing unnecessary timezone argument to \DateTime
This commit is contained in:
parent
3b42ca9ae0
commit
03dbcf8794
@ -93,10 +93,7 @@ abstract class ConstraintValidator implements ConstraintValidatorInterface
|
|||||||
// neither the native nor the stub IntlDateFormatter support
|
// neither the native nor the stub IntlDateFormatter support
|
||||||
// DateTimeImmutable as of yet
|
// DateTimeImmutable as of yet
|
||||||
if (!$value instanceof \DateTime) {
|
if (!$value instanceof \DateTime) {
|
||||||
$value = new \DateTime(
|
$value = new \DateTime($value->format('Y-m-d H:i:s.u e'));
|
||||||
$value->format('Y-m-d H:i:s.u e'),
|
|
||||||
$value->getTimezone()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $formatter->format($value);
|
return $formatter->format($value);
|
||||||
|
@ -53,10 +53,7 @@ abstract class AbstractComparisonValidatorTestCase extends ConstraintValidatorTe
|
|||||||
|
|
||||||
foreach ($comparison as $i => $value) {
|
foreach ($comparison as $i => $value) {
|
||||||
if ($value instanceof \DateTime) {
|
if ($value instanceof \DateTime) {
|
||||||
$comparison[$i] = new \DateTimeImmutable(
|
$comparison[$i] = new \DateTimeImmutable($value->format('Y-m-d H:i:s.u e'));
|
||||||
$value->format('Y-m-d H:i:s.u e'),
|
|
||||||
$value->getTimezone()
|
|
||||||
);
|
|
||||||
$add = true;
|
$add = true;
|
||||||
} elseif ('DateTime' === $value) {
|
} elseif ('DateTime' === $value) {
|
||||||
$comparison[$i] = 'DateTimeImmutable';
|
$comparison[$i] = 'DateTimeImmutable';
|
||||||
|
Reference in New Issue
Block a user