mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Scribunto
synced 2024-11-11 17:01:00 +00:00
Don't pass negative years to Language::sprintfDate
Language::sprintfDate cannot handle negative years, so don't pass them. Return an appropriate error instead. Change-Id: Ifb633631df98c82aa1c3dc8a555b91f77faf15ed
This commit is contained in:
parent
2ef8c54041
commit
203b3e75dc
|
@ -261,7 +261,9 @@ class Scribunto_LuaLanguageLibrary extends Scribunto_LuaLibraryBase {
|
|||
# Generate timestamp
|
||||
$ts = $dateObject->format( 'YmdHis' );
|
||||
|
||||
if ( $ts >= 100000000000000 ) {
|
||||
if ( $ts < 0 ) {
|
||||
throw new Scribunto_LuaError( "mw.language:formatDate() only supports years from 0" );
|
||||
} elseif ( $ts >= 100000000000000 ) {
|
||||
throw new Scribunto_LuaError( "mw.language:formatDate() only supports years up to 9999" );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue