Skip to content

Commit dbb5b82

Browse files
committed
ACP2E-977: Incorrect Dashboard YTD values
1 parent 6d2158f commit dbb5b82

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

app/code/Magento/Backend/Model/Dashboard/Chart/Date.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ public function getByPeriod(string $period): array
5656
true
5757
);
5858

59-
$timezoneLocal = $this->localeDate->getConfigTimezone();
60-
61-
$dateStart->setTimezone(new DateTimeZone($timezoneLocal));
62-
$dateEnd->setTimezone(new DateTimeZone($timezoneLocal));
63-
6459
if ($period === Period::PERIOD_24_HOURS) {
6560
$dateEnd->modify('-1 hour');
6661
} elseif ($period === Period::PERIOD_TODAY) {

app/code/Magento/Reports/Model/ResourceModel/Order/Collection.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,10 @@ protected function _getTZRangeExpressionForAttribute($range, $attribute, $tzFrom
410410
*/
411411
public function getDateRange($range, $customStart, $customEnd, $returnObjects = false)
412412
{
413-
$dateEnd = new \DateTime();
414-
$dateStart = new \DateTime();
413+
$timezoneLocal = $this->_localeDate->getConfigTimezone();
414+
415+
$dateEnd = new \DateTime('now', new \DateTimeZone($timezoneLocal));
416+
$dateStart = new \DateTime('now', new \DateTimeZone($timezoneLocal));
415417

416418
// go to the end of a day
417419
$dateEnd->setTime(23, 59, 59);
@@ -423,7 +425,6 @@ public function getDateRange($range, $customStart, $customEnd, $returnObjects =
423425
$dateEnd->modify('now');
424426
break;
425427
case '24h':
426-
$dateEnd = new \DateTime();
427428
$dateEnd->modify('+1 hour');
428429
$dateStart = clone $dateEnd;
429430
$dateStart->modify('-1 day');

0 commit comments

Comments
 (0)