• Модуль: bizproc
  • Путь к файлу: ~/bitrix/modules/bizproc/lib/basetype/date.php
  • Класс: BitrixBizprocBaseTypeDate
  • Вызов: Date::extractValue
static function extractValue(FieldType $fieldType, array $field, array $request)
{
	$value = parent::extractValue($fieldType, $field, $request);

	if ($value !== null && is_string($value) && $value <> '')
	{
		if (CBPActivity::isExpression($value))
			return $value;

		$format = static::getType() == FieldType::DATETIME ? FORMAT_DATETIME : FORMAT_DATE;
		if(!CheckDateTime($value, $format))
		{
			$value = null;
			static::addError(array(
				'code' => 'ErrorValue',
				'message' => Loc::getMessage('BPDT_DATE_INVALID'),
				'parameter' => static::generateControlName($field),
			));
		}
		else
		{
			$tzOffset = self::extractOffset($field, $request);
			$value = (static::getType() == FieldType::DATETIME) ?
				new ValueDateTime($value, $tzOffset) : new ValueDate($value, $tzOffset);

			//have to serialize in design time.
			$value = $value->serialize();
		}
	}
	else
	{
		$value = null;
	}

	return $value;
}