Skip to content

Commit

Permalink
Added new method, reverted other changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sreichel committed Dec 26, 2022
1 parent 2989993 commit 37b6653
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 2 additions & 3 deletions app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function getCreateDate()
if (!$date) {
return null;
}
return $this->formatDate(
return $this->_getCoreHelper()->formatTimezoneDate(
$date,
Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM,
true,
Expand Down Expand Up @@ -122,7 +122,7 @@ public function getLastLoginDate()
{
$date = $this->getCustomerLog()->getLoginAtTimestamp();
if ($date) {
return Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true, false);
return Mage::helper('core')->formatTimezoneDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true, false);
}
return Mage::helper('customer')->__('Never');
}
Expand Down Expand Up @@ -260,7 +260,6 @@ public function isHidden()
* Return instance of core helper
*
* @return Mage_Core_Helper_Data
* @deprecated
*/
protected function _getCoreHelper()
{
Expand Down
4 changes: 2 additions & 2 deletions app/code/core/Mage/Core/Block/Abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -1126,11 +1126,11 @@ public function helper($name)
* @param bool $useTimezone
* @return string
*/
public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, $showTime = false, $useTimezone = true)
public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, $showTime = false)
{
/** @var Mage_Core_Helper_Data $helper */
$helper = $this->helper('core');
return $helper->formatDate($date, $format, $showTime, $useTimezone);
return $helper->formatDate($date, $format, $showTime);
}

/**
Expand Down
17 changes: 15 additions & 2 deletions app/code/core/Mage/Core/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,26 @@ public function formatPrice($price, $includeContainer = true)
/**
* Format date using current locale options and time zone.
*
* @param string|Zend_Date|null $date If empty, return current datetime.
* @param string|Zend_Date|null $date If empty, return current datetime.
* @param string $format See Mage_Core_Model_Locale::FORMAT_TYPE_* constants
* @param bool $showTime Whether to include time
* @return string
*/
public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, $showTime = false)
{
return $this->formatTimezoneDate($date, $format, $showTime, true);
}

/**
* Format date using current locale options and time zone.
*
* @param string|Zend_Date|null $date If empty, return current datetime.
* @param string $format See Mage_Core_Model_Locale::FORMAT_TYPE_* constants
* @param bool $showTime Whether to include time
* @param bool $useTimezone Convert to local datetime?
* @return string
*/
public function formatDate($date = null, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, $showTime = false, $useTimezone = true)
public function formatTimezoneDate($date = null, $format = Mage_Core_Model_Locale::FORMAT_TYPE_SHORT, $showTime = false, $useTimezone = true)
{
if (!in_array($format, $this->_allowedFormats, true)) {
return $date;
Expand Down

0 comments on commit 37b6653

Please sign in to comment.