恪別𡧲版𢯢𢷮𧵑「模庉:Time ago」
Trong Dang (討論 | 㨂𢵰) 造張㵋貝內容「-- Implement Template:Time ago local numberSpell, yesno -- lazy load function numberSpell(arg) numberSpell = require('Mô đun:NumberSpell')._main return numberSpell(arg) end function yesno(arg) yesno = require('Mô đun:Yesno') return yesno(arg) end local p = {} -- Table to convert entered text values to numeric values. local timeText = { ['giây'] = 1, ['phút'] = 60, ['giờ'] = 3600, ['ngày'] = 86400, ['tuần'] = 604800, ['tháng'] = 2629800…」 𥮋:𢯢𢷮移動 Mobile web edit Advanced mobile edit |
Trong Dang (討論 | 㨂𢵰) 空固縿略𢯢𢷮 𥮋:𢯢𢷮移動 Mobile web edit Advanced mobile edit |
||
| (空顯示3番版𧵑2𠊛用於𡧲) | |||
| 𣳔4: | 𣳔4: | ||
function numberSpell(arg) | function numberSpell(arg) | ||
numberSpell = require(' | numberSpell = require('Module:NumberSpell')._main | ||
return numberSpell(arg) | return numberSpell(arg) | ||
end | end | ||
function yesno(arg) | function yesno(arg) | ||
yesno = require(' | yesno = require('Module:Yesno') | ||
return yesno(arg) | return yesno(arg) | ||
end | end | ||
| 𣳔28: | 𣳔28: | ||
-- Table containing tables of possible units to use in output. | -- Table containing tables of possible units to use in output. | ||
local timeUnits = { | local timeUnits = { | ||
[1] = { ' | [1] = { '𣆰' }, | ||
[60] = { ' | [60] = { '丿' }, | ||
[3600] = { ' | [3600] = { '𣇞' }, | ||
[86400] = { ' | [86400] = { '𣈜' }, | ||
[604800] = { ' | [604800] = { '旬', unit = 'w' }, | ||
[2629800] = { ' | [2629800] = { '𣎃', unit = 'm' }, | ||
[31557600] = { ' | [31557600] = { '𢆥', unit = 'y' } | ||
} | } | ||
| 𣳔98: | 𣳔98: | ||
local unit = timeUnits[magnitude_num].unit | local unit = timeUnits[magnitude_num].unit | ||
if unit and absTimeDiff >= 864000 then | if unit and absTimeDiff >= 864000 then | ||
local Date = require(' | local Date = require('Module:Date')._Date | ||
local input = lang:formatDate('Y-m-d H:i:s', args[1]) -- Date needs a clean date | local input = lang:formatDate('Y-m-d H:i:s', args[1]) -- Date needs a clean date | ||
input = Date(input) | input = Date(input) | ||
| 𣳔118: | 𣳔118: | ||
suffix = '' | suffix = '' | ||
else | else | ||
suffix = ' ' .. (args.ago or ' | suffix = ' ' .. (args.ago or '𠓀') | ||
end | end | ||
else -- Future | else -- Future | ||
| 𣳔148: | 𣳔148: | ||
function p.main( frame ) | function p.main( frame ) | ||
local args = require( ' | local args = require( 'Module:Arguments' ).getArgs( frame, { | ||
valueFunc = function( k, v ) | valueFunc = function( k, v ) | ||
if v then | if v then | ||
| 𣳔158: | 𣳔158: | ||
return nil | return nil | ||
end, | end, | ||
wrappers = ' | wrappers = 'Template:Thời gian trước' | ||
}) | }) | ||
return p._main( args ) | return p._main( args ) | ||