Skip to content

Commit

Permalink
ENGCOM-2215: [Backport] Remove the timezone from the date when retrie…
Browse files Browse the repository at this point in the history
…ving the current month from a UTC timestamp. #16584

 - Merge Pull Request #16584 from mageprince/magento2:2.2-develop-PR-port-16492
 - Merged commits:
   1. e233d6c
  • Loading branch information
magento-engcom-team committed Jul 6, 2018
2 parents aa6b899 + e233d6c commit 17a566c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,11 @@ protected function _getMonthInterval(\DateTime $dateStart, \DateTime $dateEnd, $
)
);
} else {
// Transform the start date to UTC whilst preserving the date. This is required as getTimestamp()
// is in UTC which may result in a different month from the original start date due to time zones.
$dateStartUtc = (new \DateTime())->createFromFormat('d-m-Y g:i:s', $dateStart->format('d-m-Y 00:00:00'));
$interval['end'] = $this->_localeDate->convertConfigTimeToUtc(
$dateStart->format('Y-m-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59')
$dateStart->format('Y-m-' . date('t', $dateStartUtc->getTimestamp()) . ' 23:59:59')
);
}

Expand Down

0 comments on commit 17a566c

Please sign in to comment.