Skip to content

Commit a2363f9

Browse files
author
Igor Melnikov
committed
Merge branch 'MAGETWO-45343-address-feedback-in-cr' into MAGETWO-43960-custom-timezone-merged
2 parents 20237d0 + ccc2cfd commit a2363f9

3 files changed

Lines changed: 8 additions & 12 deletions

File tree

app/code/Magento/Email/Model/ResourceModel/Template.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,14 @@
1414
*/
1515
class Template extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1616
{
17-
/**
18-
* @var \Magento\Framework\Stdlib\DateTime
19-
*/
20-
protected $dateTime;
21-
2217
/**
2318
* @param \Magento\Framework\Model\ResourceModel\Db\Context $context
24-
* @param \Magento\Framework\Stdlib\DateTime $dateTime
2519
* @param string $connectionName
2620
*/
2721
public function __construct(
2822
\Magento\Framework\Model\ResourceModel\Db\Context $context,
29-
\Magento\Framework\Stdlib\DateTime $dateTime,
3023
$connectionName = null
3124
) {
32-
$this->dateTime = $dateTime;
3325
parent::__construct($context, $connectionName);
3426
}
3527

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null)
235235
}
236236

237237
/**
238-
* @param \DateTimeInterface $date
238+
* @param string|\DateTimeInterface $date
239239
* @param int $dateType
240240
* @param int $timeType
241241
* @param null $locale
@@ -244,13 +244,17 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null)
244244
* @return string
245245
*/
246246
public function formatDateTime(
247-
\DateTimeInterface $date,
247+
$date,
248248
$dateType = \IntlDateFormatter::SHORT,
249249
$timeType = \IntlDateFormatter::SHORT,
250250
$locale = null,
251251
$timezone = null,
252252
$pattern = null
253253
) {
254+
if (!($date instanceof \DateTime)) {
255+
$date = new \DateTime($date);
256+
}
257+
254258
if ($timezone === null) {
255259
if ($date->getTimezone() == null || $date->getTimezone()->getName() == 'UTC'
256260
|| $date->getTimezone()->getName() == '+00:00'

lib/internal/Magento/Framework/Stdlib/DateTime/TimezoneInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function getConfigTimezone($scopeType = null, $scopeCode = null);
121121
public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null);
122122

123123
/**
124-
* @param \DateTimeInterface $date
124+
* @param string|\DateTimeInterface $date
125125
* @param int $dateType
126126
* @param int $timeType
127127
* @param null $locale
@@ -130,7 +130,7 @@ public function isScopeDateInInterval($scope, $dateFrom = null, $dateTo = null);
130130
* @return string
131131
*/
132132
public function formatDateTime(
133-
\DateTimeInterface $date,
133+
$date,
134134
$dateType = \IntlDateFormatter::SHORT,
135135
$timeType = \IntlDateFormatter::SHORT,
136136
$locale = null,

0 commit comments

Comments
 (0)