src/Definition/Type/DateType.php
public function denormalize($data)
    {
        if (!\is_string($data)) {
            throw new DenormalizationException('The value must be a string');
        }

        try {
            $date = \DateTimeImmutable::createFromFormat(
                $this->format,
                $data
            );

            if (!$date instanceof \DateTimeImmutable) {
                throw new \Exception;
            }

            return $date;
        } catch (\Throwable $e) {
            throw new DenormalizationException('The value must be a valid date');
        }
    }
public function denormalize($data)
    {
        if (!\is_string($data)) {
            throw new DenormalizationException('The value must be a string');
        }

        try {
            $date = \DateTimeImmutable::createFromFormat(
                $this->format,
                $data
            );

            if (!$date instanceof \DateTimeImmutable) {
                throw new \Exception;
            }

            return $date;
        } catch (\Throwable $e) {
            throw new DenormalizationException('The value must be a valid date');
        }
    }
{@inheritdoc}