Skip to content

Commit

Permalink
[ENG-598] 2) fix date conversions and migrate to timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
scottshipman committed Dec 17, 2018
1 parent 6b47676 commit 2edc5f3
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Controller/ExportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ public function getCampaignLeadIdsForExport($campaignId, $dateFrom, $dateTo)
->where(
$q->expr()->eq('cl.manually_removed', ':false'),
$q->expr()->eq('cl.campaign_id', ':campaign'),
$q->expr()->gte('cl.date_added', ':dateFrom'),
$q->expr()->lt('cl.date_added', ':dateTo')
$q->expr()->gte('cl.date_added', 'FROM_UNIXTIME(:dateFrom)'),
$q->expr()->lt('cl.date_added', 'FROM_UNIXTIME(:dateTo)')
)
->setParameter('false', false, 'boolean')
->setParameter('campaign', $campaignId)
Expand All @@ -140,16 +140,14 @@ public function getCampaignLeadIdsForExport($campaignId, $dateFrom, $dateTo)
*/
private function convertDateParams($dateFrom, $dateTo)
{
$timezone = new \DateTimeZone('UTC');
$dateFromConverted = new \DateTime($dateFrom);

$dateFromConverted = new \DateTime($dateFrom, $timezone);

$dateToConverted = new \DateTime($dateTo, $timezone);
$dateToConverted->modify('+1 day');
$dateToConverted = new \DateTime($dateTo);
$dateToConverted->modify('+1 day -1 second');

return [
$dateFromConverted->format('Y-m-d H:i:s'),
$dateToConverted->format('Y-m-d H:i:s'),
$dateFromConverted->getTimestamp(),
$dateToConverted->getTimestamp(),
];
}

Expand Down

0 comments on commit 2edc5f3

Please sign in to comment.