Modul:TwitterSnowflake: Unterschied zwischen den Versionen
(allow inclusion of letter after date, as is frequently done on pages using harvrefs) |
K (stray) |
||
Zeile 7: | Zeile 7: | ||
local epoch = tonumber(frame.args.epoch) or 1288834974 | local epoch = tonumber(frame.args.epoch) or 1288834974 | ||
local id_str = frame.args.id_str | local id_str = frame.args.id_str | ||
if type(id_str) ~= "string" then error("bad argument #1 (expected string, got " .. type(id_str) .. ")", 2) end | if type(id_str) ~= "string" then error("bad argument #1 (expected string, got " .. type(id_str) .. ")", 2) end | ||
if type(format) ~= "string" then error("bad argument #2 (expected string, got " .. type(format) .. ")", 2) end | if type(format) ~= "string" then error("bad argument #2 (expected string, got " .. type(format) .. ")", 2) end | ||
Zeile 40: | Zeile 39: | ||
end | end | ||
local date = Date(frame.args.date) or 0 -- if we error here, then an input of no date causes an error, which is contrary to the entire way {{TwitterSnowflake/datecheck}} works | local date = Date(frame.args.date) or 0 -- if we error here, then an input of no date causes an error, which is contrary to the entire way {{TwitterSnowflake/datecheck}} works | ||
return date - twitterdate | return date - twitterdate | ||
end | end |