mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ParserFunctions
synced 2024-11-15 20:09:43 +00:00
8a8fcf7466
Uses DateTime class in PHP 5.2+ to support dates outside the 1970-2038 range. On earlier versions will still fall back to strtotime with the old 32-bit Unix timestamp range limitations. Patch by rememberthedot -- https://bugzilla.wikimedia.org/attachment.cgi?id=5416 Added a couple quick parser test cases to confirm the new behavior. However I am seeing some annoyances with how input time zones are handled, so we'll want to clean that up at some point. :)
44 lines
716 B
Plaintext
44 lines
716 B
Plaintext
# Force the test runner to ensure the extension is loaded
|
|
# fixme... this doesn't seem to work :D
|
|
#!! functionhooks
|
|
#time
|
|
#!! endfunctionhooks
|
|
|
|
# fixme: #time seems to be accepting input as local time, which strikes me as wrong
|
|
|
|
!! test
|
|
Input times should probably be UTC, not local time
|
|
!! input
|
|
{{#time:c|15 January 2001}}
|
|
!!result
|
|
<p>2001-01-15T00:00:00+00:00
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Time test in traditional range...
|
|
!! input
|
|
{{#time:Y|15 January 2001}}
|
|
!! result
|
|
<p>2001
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Time test prior to 1970 Unix creation myth
|
|
!! input
|
|
{{#time:Y|5 April 1967}}
|
|
!! result
|
|
<p>1967
|
|
</p>
|
|
!! end
|
|
|
|
!! test
|
|
Time test after the 2038 32-bit Apocalype
|
|
!! input
|
|
{{#time:Y|28 July 2061}}
|
|
!! result
|
|
<p>2061
|
|
</p>
|
|
!! end
|