I've found a problem with an extension we installed for registering new customers via social networks. Every customer that registers through the extension gets the wrong created_at date. We have our own registration module and that one works just fine.

My timezone is UTC -6, so we get something like this.

Current Time       Displayed          Stored
                   (Admin panel)      (Database)
2015-05-14 08:00   2015-05-14 08:00   2015-05-14 14:00   <<== our module (correct)
2015-05-14 08:00   2015-05-14 14:00   2015-05-14 20:00   <<== their module

It looks like the date is converted to UTC twice, so when it is converted back to GMT for display, it is off by 6 hours.

I read this question and found out it's a Magento bug. But how can I overcome this? Why is it working in my module and not in the third party extension? I looked into their code and could only find $customer->save() being called once. I cannot set the correct date before saving since it will be overriden in the _beforeSave method of the customer model and I also can't edit the core model class. I don't think I can subscribe to the customerAfterSave event either since If I changed it there, the module that is currently working would be messed up.

  • 2
    Are you sure, they don't set the date somewhere? Because I can't imagine your model works and theirs dont :-) Or they use their own customer model? if you don't use magento methods to get the date but instead php time() etc. You get wrong results – Fabian Blechschmidt Jul 16 '15 at 17:32
  • Did you ever find a solution to this? – kmdsax Aug 28 '18 at 17:02
  • @kmdsax sorry mate, can't remember. I only remember it felt hacky. I haven't used Magento for years now. – Vic Sep 3 '18 at 22:46
  • I ran into this using IWD's Social Login extension, ended up using this patch to overcome: customerparadigm.com/… It extends Mage_Eav_Model_Entity_Attribute_Backend_Time_Created and converts $date to a timestamp before using it in a function: $date = strtotime($date); I modified slightly so that it only touches the customer class: if (!$object instanceof Mage_Customer_Model_Customer){ return parent::beforeSave($object); } – kmdsax Sep 4 '18 at 17:47