* (bug 10247) Fix IP address regex to avoid false positive IPv6 matches
* (bug 9948) Workaround for diff regression with old Mozilla versions
* (bug 10265) Fix regression in category image gallery paging
+* (bug 8577) Fix some weird misapplications of time zones.
+ {{CURRENT*}} functions now consistently use UTC as intended, while
+ {{LOCAL*}} functions return local time per server config or $wgLocaltimezone.
+ Signature dates for Japanese and other languages including weekday now show
+ the correct day to match the rest of the time in local time.
== API changes since 1.10 ==
switch ( $index ) {
case 'currentmonth':
- return $varCache[$index] = $wgContLang->formatNum( date( 'm', $ts ) );
+ return $varCache[$index] = $wgContLang->formatNum( gmdate( 'm', $ts ) );
case 'currentmonthname':
- return $varCache[$index] = $wgContLang->getMonthName( date( 'n', $ts ) );
+ return $varCache[$index] = $wgContLang->getMonthName( gmdate( 'n', $ts ) );
case 'currentmonthnamegen':
- return $varCache[$index] = $wgContLang->getMonthNameGen( date( 'n', $ts ) );
+ return $varCache[$index] = $wgContLang->getMonthNameGen( gmdate( 'n', $ts ) );
case 'currentmonthabbrev':
- return $varCache[$index] = $wgContLang->getMonthAbbreviation( date( 'n', $ts ) );
+ return $varCache[$index] = $wgContLang->getMonthAbbreviation( gmdate( 'n', $ts ) );
case 'currentday':
- return $varCache[$index] = $wgContLang->formatNum( date( 'j', $ts ) );
+ return $varCache[$index] = $wgContLang->formatNum( gmdate( 'j', $ts ) );
case 'currentday2':
- return $varCache[$index] = $wgContLang->formatNum( date( 'd', $ts ) );
+ return $varCache[$index] = $wgContLang->formatNum( gmdate( 'd', $ts ) );
case 'localmonth':
return $varCache[$index] = $wgContLang->formatNum( $localMonth );
case 'localmonthname':
case 'subjectspacee':
return( wfUrlencode( $this->mTitle->getSubjectNsText() ) );
case 'currentdayname':
- return $varCache[$index] = $wgContLang->getWeekdayName( date( 'w', $ts ) + 1 );
+ return $varCache[$index] = $wgContLang->getWeekdayName( gmdate( 'w', $ts ) + 1 );
case 'currentyear':
- return $varCache[$index] = $wgContLang->formatNum( date( 'Y', $ts ), true );
+ return $varCache[$index] = $wgContLang->formatNum( gmdate( 'Y', $ts ), true );
case 'currenttime':
return $varCache[$index] = $wgContLang->time( wfTimestamp( TS_MW, $ts ), false, false );
case 'currenthour':
- return $varCache[$index] = $wgContLang->formatNum( date( 'H', $ts ), true );
+ return $varCache[$index] = $wgContLang->formatNum( gmdate( 'H', $ts ), true );
case 'currentweek':
// @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to
// int to remove the padding
- return $varCache[$index] = $wgContLang->formatNum( (int)date( 'W', $ts ) );
+ return $varCache[$index] = $wgContLang->formatNum( (int)gmdate( 'W', $ts ) );
case 'currentdow':
- return $varCache[$index] = $wgContLang->formatNum( date( 'w', $ts ) );
+ return $varCache[$index] = $wgContLang->formatNum( gmdate( 'w', $ts ) );
case 'localdayname':
return $varCache[$index] = $wgContLang->getWeekdayName( $localDayOfWeek + 1 );
case 'localyear':
* i's" => 20'11"
*
* Backslash escaping is also supported.
+ *
+ * Input timestamp is assumed to be pre-normalized to the desired local
+ * time zone, if any.
*
* @param string $format
* @param string $ts 14-character timestamp
break;
case 'D':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $s .= $this->getWeekdayAbbreviation( date( 'w', $unix ) + 1 );
+ $s .= $this->getWeekdayAbbreviation( gmdate( 'w', $unix ) + 1 );
break;
case 'j':
$num = intval( substr( $ts, 6, 2 ) );
break;
case 'l':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $s .= $this->getWeekdayName( date( 'w', $unix ) + 1 );
+ $s .= $this->getWeekdayName( gmdate( 'w', $unix ) + 1 );
break;
case 'N':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $w = date( 'w', $unix );
+ $w = gmdate( 'w', $unix );
$num = $w ? $w : 7;
break;
case 'w':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $num = date( 'w', $unix );
+ $num = gmdate( 'w', $unix );
break;
case 'z':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $num = date( 'z', $unix );
+ $num = gmdate( 'z', $unix );
break;
case 'W':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $num = date( 'W', $unix );
+ $num = gmdate( 'W', $unix );
break;
case 'F':
$s .= $this->getMonthName( substr( $ts, 4, 2 ) );
break;
case 't':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $num = date( 't', $unix );
+ $num = gmdate( 't', $unix );
break;
case 'L':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $num = date( 'L', $unix );
+ $num = gmdate( 'L', $unix );
break;
case 'Y':
$num = substr( $ts, 0, 4 );
break;
case 'c':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $s .= date( 'c', $unix );
+ $s .= gmdate( 'c', $unix );
break;
case 'r':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );
- $s .= date( 'r', $unix );
+ $s .= gmdate( 'r', $unix );
break;
case 'U':
if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts );