Skip to content

Commit c2f3049

Browse files
committed
ACP2E-347 - removed x32 systems timestamp limitation
1 parent 77d54fb commit c2f3049

File tree

2 files changed

+4
-20
lines changed
  • dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element
  • lib/internal/Magento/Framework/Data/Form/Element

2 files changed

+4
-20
lines changed

dev/tests/integration/testsuite/Magento/Framework/Data/Form/Element/DateTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ public function testGetValue(array $data, string $expect): void
5050
*/
5151
public function getValueDataProvider(): array
5252
{
53-
$stringDates = ['2020-05-18 12:08:16', '1920-10-25 10:10:10'];
54-
$testTimestamps = [strtotime($stringDates[0]), strtotime($stringDates[1])];
55-
$dates = [new \DateTime($stringDates[0]), new \DateTime($stringDates[1])];
53+
$stringDates = ['2020-05-18 12:08:16', '1920-10-25 10:10:10', '2122-01-11 10:30:00'];
54+
$testTimestamps = [strtotime($stringDates[0]), strtotime($stringDates[1]), strtotime($stringDates[2])];
55+
$dates = [new \DateTime($stringDates[0]), new \DateTime($stringDates[1]), new \DateTime($stringDates[2])];
5656
$data = [];
5757
foreach ($testTimestamps as $key => $testTimestamp) {
5858
$data[$key] = [

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

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,6 @@ private function isDate(string $value): bool
6666
return !empty($date['year']) && !empty($date['month']) && !empty($date['day']);
6767
}
6868

69-
/**
70-
* If script executes on x64 system, converts large numeric values to timestamp limit
71-
*
72-
* @param int $value
73-
* @return int
74-
*/
75-
protected function _toTimestamp($value)
76-
{
77-
$value = (int)$value;
78-
if ($value > 3155760000) {
79-
$value = 0;
80-
}
81-
82-
return $value;
83-
}
84-
8569
/**
8670
* Set date value
8771
*
@@ -100,7 +84,7 @@ public function setValue($value)
10084
}
10185
try {
10286
if (preg_match('/^[\-]{0,1}[0-9]+$/', $value)) {
103-
$this->_value = (new \DateTime())->setTimestamp($this->_toTimestamp($value));
87+
$this->_value = (new \DateTime())->setTimestamp($value);
10488
} elseif (is_string($value) && $this->isDate($value)) {
10589
$this->_value = new \DateTime($value, new \DateTimeZone($this->localeDate->getConfigTimezone()));
10690
} else {

0 commit comments

Comments
 (0)