Skip to content

Commit b3a5ecd

Browse files
committed
Merge remote-tracking branch 'origin/MC-15075' into 2.2.8-develop-pr82
2 parents 3e4a28b + f2f91b8 commit b3a5ecd

File tree

1 file changed

+7
-6
lines changed
  • lib/internal/Magento/Framework/Data/Form/Element

1 file changed

+7
-6
lines changed

lib/internal/Magento/Framework/Data/Form/Element/Date.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,14 @@ public function setValue($value)
8282
$this->_value = $value;
8383
return $this;
8484
}
85+
if (preg_match('/^[0-9]+$/', $value)) {
86+
$this->_value = (new \DateTime())->setTimestamp($this->_toTimestamp($value));
87+
88+
return $this;
89+
}
90+
8591
try {
86-
if (preg_match('/^[0-9]+$/', $value)) {
87-
$this->_value = (new \DateTime())->setTimestamp($this->_toTimestamp($value));
88-
} else {
89-
$this->_value = new \DateTime($value);
90-
$this->_value->setTimezone(new \DateTimeZone($this->localeDate->getConfigTimezone()));
91-
}
92+
$this->_value = new \DateTime($value, new \DateTimeZone($this->localeDate->getConfigTimezone()));
9293
} catch (\Exception $e) {
9394
$this->_value = '';
9495
}

0 commit comments

Comments
 (0)