Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2431,17 +2431,17 @@ |
2432 | 2432 | |
2433 | 2433 | switch ( $index ) { |
2434 | 2434 | case 'currentmonth': |
2435 | | - return $varCache[$index] = $wgContLang->formatNum( date( 'm', $ts ) ); |
| 2435 | + return $varCache[$index] = $wgContLang->formatNum( gmdate( 'm', $ts ) ); |
2436 | 2436 | case 'currentmonthname': |
2437 | | - return $varCache[$index] = $wgContLang->getMonthName( date( 'n', $ts ) ); |
| 2437 | + return $varCache[$index] = $wgContLang->getMonthName( gmdate( 'n', $ts ) ); |
2438 | 2438 | case 'currentmonthnamegen': |
2439 | | - return $varCache[$index] = $wgContLang->getMonthNameGen( date( 'n', $ts ) ); |
| 2439 | + return $varCache[$index] = $wgContLang->getMonthNameGen( gmdate( 'n', $ts ) ); |
2440 | 2440 | case 'currentmonthabbrev': |
2441 | | - return $varCache[$index] = $wgContLang->getMonthAbbreviation( date( 'n', $ts ) ); |
| 2441 | + return $varCache[$index] = $wgContLang->getMonthAbbreviation( gmdate( 'n', $ts ) ); |
2442 | 2442 | case 'currentday': |
2443 | | - return $varCache[$index] = $wgContLang->formatNum( date( 'j', $ts ) ); |
| 2443 | + return $varCache[$index] = $wgContLang->formatNum( gmdate( 'j', $ts ) ); |
2444 | 2444 | case 'currentday2': |
2445 | | - return $varCache[$index] = $wgContLang->formatNum( date( 'd', $ts ) ); |
| 2445 | + return $varCache[$index] = $wgContLang->formatNum( gmdate( 'd', $ts ) ); |
2446 | 2446 | case 'localmonth': |
2447 | 2447 | return $varCache[$index] = $wgContLang->formatNum( $localMonth ); |
2448 | 2448 | case 'localmonthname': |
— | — | @@ -2515,19 +2515,19 @@ |
2516 | 2516 | case 'subjectspacee': |
2517 | 2517 | return( wfUrlencode( $this->mTitle->getSubjectNsText() ) ); |
2518 | 2518 | case 'currentdayname': |
2519 | | - return $varCache[$index] = $wgContLang->getWeekdayName( date( 'w', $ts ) + 1 ); |
| 2519 | + return $varCache[$index] = $wgContLang->getWeekdayName( gmdate( 'w', $ts ) + 1 ); |
2520 | 2520 | case 'currentyear': |
2521 | | - return $varCache[$index] = $wgContLang->formatNum( date( 'Y', $ts ), true ); |
| 2521 | + return $varCache[$index] = $wgContLang->formatNum( gmdate( 'Y', $ts ), true ); |
2522 | 2522 | case 'currenttime': |
2523 | 2523 | return $varCache[$index] = $wgContLang->time( wfTimestamp( TS_MW, $ts ), false, false ); |
2524 | 2524 | case 'currenthour': |
2525 | | - return $varCache[$index] = $wgContLang->formatNum( date( 'H', $ts ), true ); |
| 2525 | + return $varCache[$index] = $wgContLang->formatNum( gmdate( 'H', $ts ), true ); |
2526 | 2526 | case 'currentweek': |
2527 | 2527 | // @bug 4594 PHP5 has it zero padded, PHP4 does not, cast to |
2528 | 2528 | // int to remove the padding |
2529 | | - return $varCache[$index] = $wgContLang->formatNum( (int)date( 'W', $ts ) ); |
| 2529 | + return $varCache[$index] = $wgContLang->formatNum( (int)gmdate( 'W', $ts ) ); |
2530 | 2530 | case 'currentdow': |
2531 | | - return $varCache[$index] = $wgContLang->formatNum( date( 'w', $ts ) ); |
| 2531 | + return $varCache[$index] = $wgContLang->formatNum( gmdate( 'w', $ts ) ); |
2532 | 2532 | case 'localdayname': |
2533 | 2533 | return $varCache[$index] = $wgContLang->getWeekdayName( $localDayOfWeek + 1 ); |
2534 | 2534 | case 'localyear': |
Index: trunk/phase3/languages/Language.php |
— | — | @@ -472,6 +472,9 @@ |
473 | 473 | * i's" => 20'11" |
474 | 474 | * |
475 | 475 | * Backslash escaping is also supported. |
| 476 | + * |
| 477 | + * Input timestamp is assumed to be pre-normalized to the desired local |
| 478 | + * time zone, if any. |
476 | 479 | * |
477 | 480 | * @param string $format |
478 | 481 | * @param string $ts 14-character timestamp |
— | — | @@ -512,31 +515,31 @@ |
513 | 516 | break; |
514 | 517 | case 'D': |
515 | 518 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
516 | | - $s .= $this->getWeekdayAbbreviation( date( 'w', $unix ) + 1 ); |
| 519 | + $s .= $this->getWeekdayAbbreviation( gmdate( 'w', $unix ) + 1 ); |
517 | 520 | break; |
518 | 521 | case 'j': |
519 | 522 | $num = intval( substr( $ts, 6, 2 ) ); |
520 | 523 | break; |
521 | 524 | case 'l': |
522 | 525 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
523 | | - $s .= $this->getWeekdayName( date( 'w', $unix ) + 1 ); |
| 526 | + $s .= $this->getWeekdayName( gmdate( 'w', $unix ) + 1 ); |
524 | 527 | break; |
525 | 528 | case 'N': |
526 | 529 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
527 | | - $w = date( 'w', $unix ); |
| 530 | + $w = gmdate( 'w', $unix ); |
528 | 531 | $num = $w ? $w : 7; |
529 | 532 | break; |
530 | 533 | case 'w': |
531 | 534 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
532 | | - $num = date( 'w', $unix ); |
| 535 | + $num = gmdate( 'w', $unix ); |
533 | 536 | break; |
534 | 537 | case 'z': |
535 | 538 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
536 | | - $num = date( 'z', $unix ); |
| 539 | + $num = gmdate( 'z', $unix ); |
537 | 540 | break; |
538 | 541 | case 'W': |
539 | 542 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
540 | | - $num = date( 'W', $unix ); |
| 543 | + $num = gmdate( 'W', $unix ); |
541 | 544 | break; |
542 | 545 | case 'F': |
543 | 546 | $s .= $this->getMonthName( substr( $ts, 4, 2 ) ); |
— | — | @@ -552,11 +555,11 @@ |
553 | 556 | break; |
554 | 557 | case 't': |
555 | 558 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
556 | | - $num = date( 't', $unix ); |
| 559 | + $num = gmdate( 't', $unix ); |
557 | 560 | break; |
558 | 561 | case 'L': |
559 | 562 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
560 | | - $num = date( 'L', $unix ); |
| 563 | + $num = gmdate( 'L', $unix ); |
561 | 564 | break; |
562 | 565 | case 'Y': |
563 | 566 | $num = substr( $ts, 0, 4 ); |
— | — | @@ -592,11 +595,11 @@ |
593 | 596 | break; |
594 | 597 | case 'c': |
595 | 598 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
596 | | - $s .= date( 'c', $unix ); |
| 599 | + $s .= gmdate( 'c', $unix ); |
597 | 600 | break; |
598 | 601 | case 'r': |
599 | 602 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
600 | | - $s .= date( 'r', $unix ); |
| 603 | + $s .= gmdate( 'r', $unix ); |
601 | 604 | break; |
602 | 605 | case 'U': |
603 | 606 | if ( !$unix ) $unix = wfTimestamp( TS_UNIX, $ts ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -166,6 +166,11 @@ |
167 | 167 | * (bug 10247) Fix IP address regex to avoid false positive IPv6 matches |
168 | 168 | * (bug 9948) Workaround for diff regression with old Mozilla versions |
169 | 169 | * (bug 10265) Fix regression in category image gallery paging |
| 170 | +* (bug 8577) Fix some weird misapplications of time zones. |
| 171 | + {{CURRENT*}} functions now consistently use UTC as intended, while |
| 172 | + {{LOCAL*}} functions return local time per server config or $wgLocaltimezone. |
| 173 | + Signature dates for Japanese and other languages including weekday now show |
| 174 | + the correct day to match the rest of the time in local time. |
170 | 175 | |
171 | 176 | |
172 | 177 | == API changes since 1.10 == |