Skip to content

Commit 7b13eb3

Browse files
author
OlgaVasyltsun
committed
MC-15075: Revert Date changes
1 parent d70883e commit 7b13eb3

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)