Page MenuHomePhabricator

Month dropdown value changes to following month on Special:Log after running search
Closed, ResolvedPublic

Description

In Special:Log, when I select a month and a year and then click "Show", the month selector box changes to the following month. For example, Special:Log with "month=6" and "year=2016" shows "July" in the "From month (and earlier)" box. It should instead show "June", just like it had always been.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 19 2017, 9:26 PM
Aklapper renamed this task from Month changes to following month in Special:Log to Month dropdown value changes to following month on Special:Log after running search.Jul 20 2017, 10:29 AM

I bet this is caused by

ReverseChronologicalPager.php
// Treat the given time in the wiki timezone and get a UTC timestamp for the database lookup
$timestamp = self::getOffsetDate( $year, $month, $day );
$timestamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) );

try {
  $this->mYear = (int)$timestamp->format( 'Y' );
  $this->mMonth = (int)$timestamp->format( 'm' );
  $this->mDay = (int)$timestamp->format( 'd' );
  $this->mOffset = $this->mDb->timestamp( $timestamp->getTimestamp() );
} catch ( TimestampException $e ) {
  // Invalid user provided timestamp (T149257)
  return null;
}

The code tweaks the actual timestamp to fit users' timezone setting. If the timezone is greater than +00:00, it's in the following month (and possibly year).

Change 447360 had a related patch set uploaded (by Prtksxna; owner: Prtksxna):
[mediawiki/core@master] ChronologicalPager: getDateCond: Change default $day to month beginning

https://gerrit.wikimedia.org/r/447360

Change 447559 had a related patch set uploaded (by Bartosz Dziewoński; owner: Bartosz Dziewoński):
[mediawiki/core@master] ReverseChronologicalPager: Fix timezone confusion

https://gerrit.wikimedia.org/r/447559

Change 447360 abandoned by Prtksxna:
ChronologicalPager: getDateCond: Change default $day to month beginning

Reason:
See I8c2cd398d7c7ac68a8f46ee94cb9e7c6beed5694.

https://gerrit.wikimedia.org/r/447360

Change 447559 merged by jenkins-bot:
[mediawiki/core@master] ReverseChronologicalPager: Fix timezone confusion

https://gerrit.wikimedia.org/r/447559

Jdforrester-WMF closed this task as Resolved.Jul 31 2018, 3:53 PM
Jdforrester-WMF assigned this task to matmarex.
Jdforrester-WMF removed a project: Patch-For-Review.