恪別𡧲版𢯢𢷮𧵑「模庉: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('Mô đun:NumberSpell')._main
numberSpell = require('Module:NumberSpell')._main
return numberSpell(arg)
return numberSpell(arg)
end
end


function yesno(arg)
function yesno(arg)
yesno = require('Mô đun:Yesno')
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] = { 'giây' },
[1] = { '𣆰' },
[60] = { 'phút' },
[60] = { '丿' },
[3600] = { 'giờ' },
[3600] = { '𣇞' },
[86400] = { 'ngày' },
[86400] = { '𣈜' },
[604800] = { 'tuần', unit = 'w' },
[604800] = { '', unit = 'w' },
[2629800] = { 'tháng', unit = 'm' },
[2629800] = { '𣎃', unit = 'm' },
[31557600] = { 'năm', unit = 'y' }
[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('Mô đun:Date')._Date
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 'trước')
suffix = ' ' .. (args.ago or '𠓀')
end
end
else -- Future
else -- Future
𣳔148: 𣳔148:


function p.main( frame )
function p.main( frame )
local args = require( 'Mô đun:Arguments' ).getArgs( frame, {
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 = 'Bản mẫu:Thời gian trước'
wrappers = 'Template:Thời gian trước'
})
})
return p._main( args )
return p._main( args )