![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/vendor/magento/module-backend/Block/Widget/Grid/Column/Renderer/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Backend\Block\Widget\Grid\Column\Renderer; use Magento\Framework\Stdlib\DateTime\DateTimeFormatterInterface; /** * Backend grid item renderer date * @api * @deprecated 100.2.0 in favour of UI component implementation * @since 100.0.2 */ class Date extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer { /** * @var int */ protected $_defaultWidth = 160; /** * Date format string * * @var string */ protected static $_format = null; /** * @var DateTimeFormatterInterface */ protected $dateTimeFormatter; /** * @param \Magento\Backend\Block\Context $context * @param DateTimeFormatterInterface $dateTimeFormatter * @param array $data */ public function __construct( \Magento\Backend\Block\Context $context, DateTimeFormatterInterface $dateTimeFormatter, array $data = [] ) { parent::__construct($context, $data); $this->dateTimeFormatter = $dateTimeFormatter; } /** * Retrieve date format * * @return string * @deprecated 100.1.0 */ protected function _getFormat() { $format = $this->getColumn()->getFormat(); if ($format === null) { if (self::$_format === null) { try { self::$_format = $this->_localeDate->getDateFormat( \IntlDateFormatter::MEDIUM ); } catch (\Exception $e) { $this->_logger->critical($e); } } $format = self::$_format; } return $format; } /** * Renders grid column * * @param \Magento\Framework\DataObject $row * @return string */ public function render(\Magento\Framework\DataObject $row) { $format = $this->getColumn()->getFormat(); $date = $this->_getValue($row); if ($date) { if (!($date instanceof \DateTimeInterface)) { $date = new \DateTime($date); } return $this->_localeDate->formatDateTime( $date, $format ?: \IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, null, $this->getColumn()->getTimezone() === false ? 'UTC' : null ); } return $this->getColumn()->getDefault(); } }