This topic can no longer be replied to because it has been locked.

Incorrect Date format sent to MailChimp
Joined: 2012-10-27
Posts: 6
Hi, I have just had an issue with the date export to MailChimp.

The Model/Observer.php->attachTbtMergeVars() gets the dates of expiry, last spent and last earned from Sweet Tooth and gets them ready to be sent to MailChimp. The problem i was having is that the format sent to MailChimp was in US English format and so was screwing up my UK english dates. For Example 7th March 2015 was not being interpreted correctly and was ending up as the 3rd July...

MailChimp accepts the unambiguous date format YYY-MM-DD as an input so I updated the Observer to fix this issue.

So Code updated in Model/Observer.php:

Line 105:
From : $earn = $this->_formatDateMerge($transfer->getEffectiveStart());
To : $earn = date_format(date_create_from_format('Y-m-d H:i:s', $transfer->getEffectiveStart()), 'Y-m-d');

Line 107:
From : $spent = $this->_formatDateMerge($transfer->getEffectiveStart());
To : $spent = date_format(date_create_from_format('Y-m-d H:i:s', $transfer->getEffectiveStart()), 'Y-m-d');

Line 131 - 132:
From :
if($val){ $tbtVars['PTSEXP'] = $val; }
To :
if($val){ $val = date_format(date_create_from_format('d/m/Y', $val), 'Y-m-d'); $tbtVars['PTSEXP'] = $val; }

Joined: 2014-08-07
Posts: 2628
Hello John,

Thank you very much for this feedback.
It is really appreciated and it will be added for next release.

If you like Sweet Monkey and MageMonkey you should know that the two extensions will be merged into one for next release.
Also please take the time to place a review for MageMonkey at under tab "Reviews". It will help us remaining improving and free.

Best Regards,


Subscribe to our newsletter to receive emails and useful news articles