It extracts following tokens from the string: operator, left dateTime, right dateTime

@param string $value value of the parameter

@return void

@throws InvalidArgumentException
329494
protected function extractTokens($value)
    {
        if (empty($value)) {
            throw new InvalidArgumentException('DateRangeParser: Value can\'t be empty');
        }

        $operation = substr($value, 0, 1);

        if ($operation === '!') {
            $this->operation = 'not between';
            $value           = substr($value, 1);
        }

        $dateTimes = explode(',', $value);

        $this->from = $dateTimes[0];
        $this->to   = $dateTimes[1];
    }
1362174
public function checkValue(&$value)
    {
        if (is_string($value)) {
            $value = Placeholder::replaceStringsAndComments($value);
            $value = Placeholder::removeCommentPlaceholders($value, true);
            $value = Placeholder::replaceStringPlaceholders($value, true);
            $value = trim($value);

            if ($value !== '') {
                return true;
            } else {
                $this->setIsValid(false);
            }
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($value). "' for argument 'value' given."
            );
        }
    }
474721
public function setDefault($value)
    {
        if (($value instanceof DateTime) === false) {
            throw new InvalidArgumentException(
                "invalid value provided for 'value'; ".
                "expecting an instance of DateTime"
            );
        }
        $this->defaultValue = $value;
        return $this;
    }
1030092
protected function normalizeDateTime($value)
    {
        if ($value === '' || $value === null) {
            return $value;
        }

        if (!is_string($value) && !is_int($value) && !$value instanceof DateTime) {
            return $value;
        }

        if (is_int($value)) {
            //timestamp
            $value = new DateTime('@' . $value);
        } elseif (!$value instanceof DateTime) {
            $value = new DateTime($value);
        }

        return $value->format($this->format);
    }
961061
public static function assertValidChoice(string $value): void
    {
        if (!isset(static::$choices[$value])) {
            throw new \InvalidArgumentException(\sprintf('Invalid value "%s" for ENUM type "%s".', $value, static::class));
        }
    }
518163
public function formatTime($value)
	{
		return $this->getLocale()->dateFormatter->formatDateTime($this->normalizeDateValue($value), null, $this->timeFormat);
	}
391452
protected static function parseValue($value)
    {
        if ($value instanceof \DateTime) {
            return 'new \\DateTime(' . \var_export($value->format('c'), true) . ')';
        }

        if (!\is_string($value)) {
            return \var_export($value, true);
        }

        if (\preg_match('/%([a-zA-Z0-9_:\\\]+)(?::(.*))?%/', $value, $matches)) {
            $function = $matches[1];

            if (!\function_exists($function)) {
                return $value;
            }

            if (!isset($matches[2])) {
                return $function . '()';
            }

            $args = \explode(',', $matches[2]);
            foreach ($args as &$a) {
                $a = static::parseConstant(\trim($a));
            }

            return $function . '(' . \implode(', ', $args) . ')';
        }

        return static::parseConstant($value);
    }
990936
public function filter($value)
    {
        if ($value instanceof \DateTime) {
            return $value;
        }
        
        try {
            $datetime = new \DateTime($value);
        } catch (\Exception $exception) {
            return false;
        }
        
        return $datetime;
    }
474330
protected function convert_string( $value ) {

		$format = $this->input_data[ 'format' ];
		$date   = \DateTime::createFromFormat( $format, $value );

		// Invalid dates can show up as warnings (ie. "2007-02-99") and still return a DateTime object.
		$errors = \DateTime::getLastErrors();
		if ( $errors[ 'warning_count' ] > 0 ) {
			$this->error_code = Error\ErrorLoggerInterface::INVALID_DATE_FORMAT;

			return FALSE;
		}

		return $date;
	}
815302
public static function stringOrInteger($value)
    {
        if (!is_string($value) and !is_int($value)) {
            $message = sprintf('Value "%s" expected to be string or integer, type %s given.', static::stringify($value), gettype($value));

            throw static::createException($value, $message, static::INVALID_STRING_INTEGER, null);
        }
    }
629261
public function filter($value)
    {
	    if (is_string($value))
	        return new DateTime('@'.strtotime($value));
	    if ($value instanceof DateTime)
		    return $value;
	    if (is_int($value))
		    return new DateTime('@'.$value);
	    return null;
    }
136989
private function parseDate(string $type, $value)
    {
        try {
            switch ($type) {
                case 'datetime':
                    $datetime = DateTime::createFromFormat('Y-m-d\TH:i:s', $value);
                    break;

                case 'date':
                    $datetime = Date::createFromFormat('Y-m-d', $value);
                    break;

                case 'time':
                    $datetime = Time::createFromFormat('H:i:s', $value);
                    break;

                default:
                    throw new \InvalidArgumentException(sprintf("Invalid parse date type '%s'", $type));
            }
        } catch (\Exception $exception) {
            return null;
        }

        return $datetime;
    }
18367
public function toString($value)
    {
        if ($value instanceof \DateTime) { // datetime in ISO8601 format
            return $value->format(\DateTime::ISO8601);
        } else if (is_bool($value)) {
            return $value ? 1 : 0;
        } else {
            return $value;
        }
    }
845990
public function serialize($value) : string
    {
        if (!$value instanceof \DateTimeInterface) {
            throw InvalidValueException::valueDoesNotMatchType($this, $value);
        }

        return (string) $value->format($this->format);
    }
346335
public function hydrate($value)
    {
        if ($this->nullable && $value === null) {
            return null;
        }

        if (is_string($value) || is_int($value)) {
            if ($dateTime = DateTime::createFromFormat($this->getFormat(), $value)) {
                return $dateTime;
            }

            throw new Exception\InvalidArgumentException(sprintf(
                'Invalid format or value: format must be a string representing a valid \DateTime format, "%s" given;' .
                'value must be a string representing the time according to \DateTime::createFromFormat(), "%s" given.',
                $this->getFormat(),
                $value
            ));
        }

        throw new Exception\InvalidArgumentException(sprintf(
            'Invalid value: must be a string or integer representing the time according to the format, "%s" given',
            is_object($value) ? get_class($value) : gettype($value)
        ));
    }
573380
public function where(string $field, $value)
    {
        $matches = [];
        // We check whether there is a specific operator in the field name,
        // and if so we validate it against a whitelist
        if (\preg_match('/(.+)\[([a-zA-Z]+)\]/', $field, $matches)) {
            $operator = \mb_strtolower($matches[2]);

            if (!\in_array($operator, self::$validOperators, true)) {
                throw new \InvalidArgumentException(\sprintf(
                    'Unknown operator "%s" given. Expected "%s" or no operator.',
                    $operator,
                    \implode(', ', self::$validOperators)
                ));
            }
        }

        if ($value instanceof \DateTimeInterface) {
            $value = $value->format(self::DATE_FORMAT);
        }
        if ($value instanceof Location) {
            $value = $value->queryStringFormatted();
        }
        if (\is_array($value)) {
            $value = \implode(',', $value);
        }

        $this->whereConditions[$field] = $value;

        return $this;
    }
616902
public function filter($value)
    {
        try {
            $result = $this->normalizeDateTime($value);
        } catch (\Exception $e) {
            // DateTime threw an exception, an invalid date string was provided
            throw new Exception\InvalidArgumentException('Invalid date string provided', $e->getCode(), $e);
        }

        if ($result === false) {
            return $value;
        }

        return $result;
    }