eZ\Publish\Core\FieldType\DateAndTime\Type::createValueFromInput PHP Method

createValueFromInput() protected method

Inspects given $inputValue and potentially converts it into a dedicated value object.
protected createValueFromInput ( string | integer | DateTim\DateTime | Value $inputValue ) : Value
$inputValue string | integer | DateTim\DateTime | Value
return Value The potentially converted and structurally plausible value.
    protected function createValueFromInput($inputValue)
    {
        if (is_string($inputValue)) {
            $inputValue = Value::fromString($inputValue);
        }
        if (is_int($inputValue)) {
            $inputValue = Value::fromTimestamp($inputValue);
        }
        if ($inputValue instanceof DateTime) {
            $inputValue = new Value($inputValue);
        }
        return $inputValue;
    }