Remove incorrect timezone conversion from date parameters
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 23 Jul 2018 22:35:34 +0000 (00:35 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Thu, 26 Jul 2018 20:13:38 +0000 (20:13 +0000)
This affects at least Special:Log and Special:Contributions.

The setTimezone() call does not actually change the offset used for
database lookup, because getTimestamp() returns a Unix timestamp,
which by definition does not include timezone information.

We don't actually want to do anything with timezones here. Whether
we like it or not, these date selectors have always used UTC dates.

Follow-up to I8c2cd398d7c7ac68a8f46ee94cb9e7c6beed5694.

Change-Id: Ia034017af5b37da3aa4889d5b7680c8be423126e

includes/pager/RangeChronologicalPager.php
includes/specials/SpecialLog.php

index d3cb566..bf36983 100644 (file)
@@ -45,14 +45,12 @@ abstract class RangeChronologicalPager extends ReverseChronologicalPager {
                try {
                        if ( $startStamp !== '' ) {
                                $startTimestamp = MWTimestamp::getInstance( $startStamp );
-                               $startTimestamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) );
                                $startOffset = $this->mDb->timestamp( $startTimestamp->getTimestamp() );
                                $this->rangeConds[] = $this->mIndexField . '>=' . $this->mDb->addQuotes( $startOffset );
                        }
 
                        if ( $endStamp !== '' ) {
                                $endTimestamp = MWTimestamp::getInstance( $endStamp );
-                               $endTimestamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) );
                                $endOffset = $this->mDb->timestamp( $endTimestamp->getTimestamp() );
                                $this->rangeConds[] = $this->mIndexField . '<=' . $this->mDb->addQuotes( $endOffset );
 
index 359eede..82bdd84 100644 (file)
@@ -64,8 +64,6 @@ class SpecialLog extends SpecialPage {
                $dateString = $this->getRequest()->getVal( 'wpdate' );
                if ( !empty( $dateString ) ) {
                        $dateStamp = MWTimestamp::getInstance( $dateString . ' 00:00:00' );
-                       $dateStamp->setTimezone( $this->getConfig()->get( 'Localtimezone' ) );
-
                        $opts->setValue( 'year', (int)$dateStamp->format( 'Y' ) );
                        $opts->setValue( 'month', (int)$dateStamp->format( 'm' ) );
                        $opts->setValue( 'day', (int)$dateStamp->format( 'd' ) );