Over the weekend (2014-10-04 midnight through 2014-10-06 noon) I noticed that the customer created and last logged in dates were incorrect in the Admin.
Last Logged In: Oct 6, 8295 10:12:43 AM (Offline)
Last Logged In (America/New_York): Oct 4, 2014 11:58:15 AM (Offline)
Account Created on: Oct 6, 8187 10:12:43 AM
Account Created on (America/New_York): Oct 4, 2014 11:56:27 AM
This was happening only for updates (new customers, customer logins) that occurred within that timeframe; it stopped at noon on 2014-10-06. The database is correct.
After digging around, I found that the below methods in Mage_Adminhtml_Block_Customer_Edit_Tab_View are returning timestamps:
public function getCreateDate()
{
return Mage::helper('core')->formatDate($this->getCustomer()->getCreatedAtTimestamp(),
Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
}
public function getLastLoginDate()
{
$date = $this->getCustomerLog()->getLoginAtTimestamp();
if ($date) {
return Mage::helper('core')->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM, true);
}
return Mage::helper('customer')->__('Never');
}
Looking at Mage_Core_Helper_Data::formatDate($date), there is a line that, after checking that the input date is not an instance of Zend_Date, it converts it using strtotime:
$date = Mage::app()->getLocale()->date(strtotime($date), null, null);
So it seems that it is converting an existing timestamp twice.
Can anyone tell me why this would only get screwed up for the aforementioned timeframe? I'm not sure why the block methods are converting to timestamps ahead of time, but it has never been an issue until now (and seems to no longer be an issue).