1111 */
1212namespace Magento \Reports \Controller \Adminhtml \Report ;
1313
14- use Magento \Framework \Stdlib \DateTime \DateTimeFormatterInterface ;
14+ use Magento \Framework \Stdlib \DateTime \TimezoneInterface ;
1515
1616abstract 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