Skip to content

Commit 9aeba1b

Browse files
author
Igor Melnikov
committed
Merge remote-tracking branch 'origin/MAGETWO-45286-report-message' into MAGETWO-43960-custom-timezone-merged
2 parents a2363f9 + 418869c commit 9aeba1b

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/
1212
namespace Magento\Reports\Controller\Adminhtml\Report;
1313

14-
use Magento\Framework\Stdlib\DateTime\DateTimeFormatterInterface;
14+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1515

1616
abstract class AbstractReport extends \Magento\Backend\App\Action
1717
{
@@ -26,26 +26,26 @@ abstract class AbstractReport extends \Magento\Backend\App\Action
2626
protected $_dateFilter;
2727

2828
/**
29-
* @var DateTimeFormatterInterface
29+
* @var TimezoneInterface
3030
*/
31-
protected $dateTimeFormatter;
31+
protected $timezone;
3232

3333
/**
3434
* @param \Magento\Backend\App\Action\Context $context
3535
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
3636
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
37-
* @param DateTimeFormatterInterface $dateTimeFormatter
37+
* @param TimezoneInterface $timezone
3838
*/
3939
public function __construct(
4040
\Magento\Backend\App\Action\Context $context,
4141
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
4242
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
43-
DateTimeFormatterInterface $dateTimeFormatter
43+
TimezoneInterface $timezone
4444
) {
4545
parent::__construct($context);
4646
$this->_fileFactory = $fileFactory;
4747
$this->_dateFilter = $dateFilter;
48-
$this->dateTimeFormatter = $dateTimeFormatter;
48+
$this->timezone = $timezone;
4949
}
5050

5151
/**
@@ -134,14 +134,10 @@ protected function _showLastExecutionTime($flagCode, $refreshCode)
134134
$flag = $this->_objectManager->create('Magento\Reports\Model\Flag')->setReportFlagCode($flagCode)->loadSelf();
135135
$updatedAt = 'undefined';
136136
if ($flag->hasData()) {
137-
$updatedAt = $this->dateTimeFormatter->formatObject(
138-
$this->_objectManager->get(
139-
'Magento\Framework\Stdlib\DateTime\TimezoneInterface'
140-
)->scopeDate(
141-
0,
142-
$flag->getLastUpdate(),
143-
true
144-
)
137+
$updatedAt = $this->timezone->formatDate(
138+
$flag->getLastUpdate(),
139+
\IntlDateFormatter::MEDIUM,
140+
true
145141
);
146142
}
147143

0 commit comments

Comments
 (0)