Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.1-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #16585: [Backport] Remove the timezone from the date when retrieving the current month from a UTC timestamp. (by @mageprince)
 - #16632: [Backport] Small refactoring to better code readability (by @ronak2ram)


Fixed GitHub Issues:
 - #15940: Wrong end of month at Reports for Europe/Berlin time zone if month contains 31 day (reported by @Stepa4man) has been fixed in #16585 by @mageprince in 2.1-develop branch
   Related commits:
     1. efbe4de
  • Loading branch information
Stanislav Idolov authored Jul 12, 2018
2 parents e72b563 + 45bc0c9 commit 2b53bf2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
20 changes: 12 additions & 8 deletions app/code/Magento/Backend/Block/Widget/Form/Element/Dependence.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,18 @@ protected function _toHtml()
if (!$this->_depends) {
return '';
}
return '<script>
require(["mage/adminhtml/form"], function(){
new FormElementDependenceController(' .
$this->_getDependsJson() .
($this->_configOptions ? ', ' .
$this->_jsonEncoder->encode(
$this->_configOptions
) : '') . '); });</script>';

$params = $this->_getDependsJson();

if ($this->_configOptions) {
$params .= ', ' . $this->_jsonEncoder->encode($this->_configOptions);
}

return "<script>
require(['mage/adminhtml/form'], function(){
new FormElementDependenceController({$params});
});
</script>";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,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
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,4 @@ DoubleColon
BarFactory
PartialNamespace\BarFactory
Product\OptionFactory
FormElementDependenceController

0 comments on commit 2b53bf2

Please sign in to comment.