X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpager%2FReverseChronologicalPager.php;h=e8f3f408a1a86236b9e53507d0c90c7308d80daa;hb=e900893531e76fb8f80c1c9b5be459fd02862c3c;hp=9eef728a93337f5186e51b778655d889914c6c5f;hpb=3f59cb9f3a53ad28f8a95fe299c5de6abd24b453;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/pager/ReverseChronologicalPager.php b/includes/pager/ReverseChronologicalPager.php index 9eef728a93..e8f3f408a1 100644 --- a/includes/pager/ReverseChronologicalPager.php +++ b/includes/pager/ReverseChronologicalPager.php @@ -26,9 +26,13 @@ use Wikimedia\Timestamp\TimestampException; * @ingroup Pager */ abstract class ReverseChronologicalPager extends IndexPager { + /** @var bool */ public $mDefaultDirection = IndexPager::DIR_DESCENDING; + /** @var int */ public $mYear; + /** @var int */ public $mMonth; + /** @var int */ public $mDay; public function getNavigationBar() { @@ -81,14 +85,16 @@ abstract class ReverseChronologicalPager extends IndexPager { return null; } - // 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' ); + // The timestamp used for DB queries is at midnight of the *next* day after the selected date. + $selectedDate = new DateTime( $timestamp->getTimestamp( TS_ISO_8601 ) ); + $selectedDate = $selectedDate->modify( '-1 day' ); + + $this->mYear = (int)$selectedDate->format( 'Y' ); + $this->mMonth = (int)$selectedDate->format( 'm' ); + $this->mDay = (int)$selectedDate->format( 'd' ); $this->mOffset = $this->mDb->timestamp( $timestamp->getTimestamp() ); } catch ( TimestampException $e ) { // Invalid user provided timestamp (T149257)