summaryrefslogtreecommitdiff
path: root/extensions/ParserFunctions/ParserFunctions_body.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-08-12 09:28:15 +0200
commit08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch)
tree577a29fb579188d16003a209ce2a2e9c5b0aa2bd /extensions/ParserFunctions/ParserFunctions_body.php
parentcacc939b34e315b85e2d72997811eb6677996cc1 (diff)
Update to MediaWiki 1.21.1
Diffstat (limited to 'extensions/ParserFunctions/ParserFunctions_body.php')
-rw-r--r--extensions/ParserFunctions/ParserFunctions_body.php12
1 files changed, 7 insertions, 5 deletions
diff --git a/extensions/ParserFunctions/ParserFunctions_body.php b/extensions/ParserFunctions/ParserFunctions_body.php
index 879b7a15..967e8339 100644
--- a/extensions/ParserFunctions/ParserFunctions_body.php
+++ b/extensions/ParserFunctions/ParserFunctions_body.php
@@ -452,10 +452,10 @@ class ExtParserFunctions {
} else {
$tz = new DateTimeZone( date_default_timezone_get() );
}
- $dateObject->setTimezone( $tz );
} else {
- $dateObject->setTimezone( $utc );
+ $tz = $utc;
}
+ $dateObject->setTimezone( $tz );
# Generate timestamp
$ts = $dateObject->format( 'YmdHis' );
@@ -471,14 +471,16 @@ class ExtParserFunctions {
if ( self::$mTimeChars > self::$mMaxTimeChars ) {
return '<strong class="error">' . wfMessage( 'pfunc_time_too_long' )->inContentLanguage()->escaped() . '</strong>';
} else {
- if ( $ts < 100000000000000 ) { // Language can't deal with years after 9999
+ if ( $ts < 0 ) { // Language can't deal with BC years
+ return '<strong class="error">' . wfMessage( 'pfunc_time_too_small' )->inContentLanguage()->escaped() . '</strong>';
+ } elseif ( $ts < 100000000000000 ) { // Language can't deal with years after 9999
if ( $language !== '' && Language::isValidBuiltInCode( $language ) ) {
// use whatever language is passed as a parameter
$langObject = Language::factory( $language );
- $result = $langObject->sprintfDate( $format, $ts );
+ $result = $langObject->sprintfDate( $format, $ts, $tz );
} else {
// use wiki's content language
- $result = $parser->getFunctionLang()->sprintfDate( $format, $ts );
+ $result = $parser->getFunctionLang()->sprintfDate( $format, $ts, $tz );
}
} else {
return '<strong class="error">' . wfMessage( 'pfunc_time_too_big' )->inContentLanguage()->escaped() . '</strong>';