diff --git a/src/IPub/FormDateTime/Controls/Time.php b/src/IPub/FormDateTime/Controls/Time.php index 0267671..102b555 100644 --- a/src/IPub/FormDateTime/Controls/Time.php +++ b/src/IPub/FormDateTime/Controls/Time.php @@ -141,6 +141,12 @@ public function getControlPart($key) $name = $this->getHtmlName(); if ($key === static::FIELD_NAME_TIME) { + if (method_exists('Nette\Forms\Helpers', 'exportRules')) { + $exportedRules = Forms\Helpers::exportRules($this->rules); + } else { + $exportedRules = self::exportRules($this->rules); + } + $control = Utils\Html::el('input'); $control->addAttributes([ 'name' => ($name . '[' . static::FIELD_NAME_TIME . ']'), @@ -148,7 +154,7 @@ public function getControlPart($key) 'value' => $this->value ? $this->value->format($this->toPhpFormat($this->timeFormat)) : NULL, 'required' => $this->isRequired(), 'disabled' => $this->isDisabled(), - 'data-nette-rules' => self::exportRules($this->rules) ?: NULL, + 'data-nette-rules' => $exportedRules ?: NULL, ]); if ($this->disabled) { @@ -363,4 +369,4 @@ public static function register($timeFormat = self::W3C_TIME_FORMAT, $language = } ); } -} \ No newline at end of file +}