Jump to content

Module:Date table sorting

Permanently protected module
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Tsahee (talk | contribs) at 14:32, 26 December 2013 (Created page with 'local p = {} function p.dts(frame) -- retval = '<span style="display:none" class="sortkey">' year=tonumber(frame.args[1]) month=tonumber(frame.args[...'). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

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|}}}}}&#32;!
    -- 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|}}}}}&nbsp;{{MONTHABBREV|{{{2|}}}}}|{{MONTHABBREV4|{{{2|}}}}}&nbsp;{{#switch:{{{3|}}}|01=1|02=2|03=3|04=4|05=5|06=6|07=7|08=8|09=9|{{{3|}}}}},}}&nbsp;{{{1|}}}</span><noinclude>{{being deleted|2013 August 15|merge=Template:dts}}{{documentation}}</noinclude>
end

return p