Content deleted Content added
use Data:DateI18n.tab as main repository of language dependent settings |
m Protected "Module:DateI18n" ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 15:
* User:Jarekt - original version of the functions mimicking template:Date
]]
require('
-- ==================================================
Line 72:
-- if month is not a number than check if it is a month name in project's language
local month = datevec[2]
if month and month~='' and not tonumber(month) then
datevec[2] = mw.getContentLanguage():formatDate( "n", month)
end
Line 78:
-- create datecode based on which variables are provided and check for out-of-bound values
local maxval = {nil, 12, 31, 23, 59, 59, 23, 59} -- max values for year, month, ...
local minval = {nil, 1, 1,
local c = {'Y', 'M', 'D', 'H', 'M', 'S', '', ''}
local datecode = '' -- a string signifying which combination of variables was provided
Line 319:
-- use {{#time}} parser function to create timezone string, so that we use correct character set
local sign = (datenum[7]<0) and '−' or '+'
timeStamp = string.format("2000-01-01 %02i:%02i:00", math.abs(datenum[7]),
local timezone = mw.language.new(lang):formatDate( 'H:i', timeStamp) -- same as using {{#time}} parser function
datestr = string.format("%s %s%s", datestr, sign, timezone )
|