Skip to content

Wrong end of month at Reports for Europe/Berlin time zone if month contains 31 day #15940

@Stepa4man

Description

@Stepa4man

Preconditions

  1. Set Timezone "Central European Standard Time (Europe/Berlin)" at the STORE->CONFIGURATION->GENERAL->General->Local options-> Timezone and save configuration
  2. Create orders at 31-st day of a month which has this date (May will be used for example)

Steps to reproduce

  1. Go to the Reports adminhtml menu "Products">"Ordered" grid
  2. Select "From" - 01.05.2018
  3. Select "To" - 31.05.2018
  4. Select "Show by" - Month
  5. Hit refresh

Expected result

  1. Orders that were created at 31.05.2018 are in the grid

Actual result

  1. Orders that were created at 31.05.2018 are NOT in the grid

Comment:
MAGE_ROOT/vendor/magento/module-reports/Model/ResourceModel/Report/Collection.php:218
$interval['end'] filled with 30.05.2018 instead of 31.05.2018

My solution:
Replace: $dateStart->format('Y-m-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59')
with:
$dateStart->format('Y-m-' . cal_days_in_month(CAL_GREGORIAN, $dateStart->format('m'), $dateStart->format('Y')) . ' 23:59:59')

System:
Ububntu16.04/MySQL5.7/PHP7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.1.xThe issue has been fixed in 2.1 release lineFixed in 2.2.xThe issue has been fixed in 2.2 release lineFixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: Format is validGate 1 Passed. Automatic verification of issue format passed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions