Module:Date table sorting
Appearance
![]() | This Lua module is used on approximately 44,000 pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
This module implements {{Date table sorting}}. Please see the template page for documentation.
local p = {}
function p.dts(frame)
-- retval = '<span style="display:none" class="sortkey">'
year=tonumber(frame.args[1])
month=tonumber(frame.args[2])
day=tonumber(frame.args[3])
retval = retval .. year
if (month<10) then
retval = retval.. "0"
end
retval = retval .. month
if (day<10) then
retval = retval.. "0"
end
retval = retval .. month
return retval
-- {{{1|}}}-{{MONTH|{{{2|}}}}}-{{#switch:{{{3|}}}|1=01|2=02|3=03|4=04|5=05|6=06|7=07|8=08|9=09|{{{3|}}}}} !
-- retval = retval .. "</span><span class="sorttext">{{#ifeq:{{{format|}}}|dmy|{{#switch:{{{3|}}}|01=1|02=2|03=3|04=4|05=5|06=6|07=7|08=8|09=9|{{{3|}}}}} {{MONTHABBREV|{{{2|}}}}}|{{MONTHABBREV4|{{{2|}}}}} {{#switch:{{{3|}}}|01=1|02=2|03=3|04=4|05=5|06=6|07=7|08=8|09=9|{{{3|}}}}},}} {{{1|}}}</span><noinclude>{{being deleted|2013 August 15|merge=Template:dts}}{{documentation}}</noinclude>
end
return p