אונטערשייד צווישן ווערסיעס פון "יחידה:דאטום"

299 בייטן צוגעלייגט ,  פֿאַר 2 יאָר
אפדעיט
(אפדעיט)
צייכן: צוריקגעשטעלט
(אפדעיט)
צייכן: צוריקגעשטעלט
שורה 458: שורה 458:


     return Date.new( definition )
     return Date.new( definition )
end
local function stringsWithOnlyNumbers(inputArray)
  local resultArray = {}
  for i, str in ipairs(inputArray) do
    if string.match(str, "^-?%d+$") then
      table.insert(resultArray, str)
    end
  end
  return resultArray
end
end


שורה 489: שורה 501:


local parts = mw.text.split(mw.text.trim(wikitext),' ')
local parts = mw.text.split(mw.text.trim(wikitext),' ')
 
parts = stringsWithOnlyNumbers(parts)
     local definition = {}
     local definition = {}
definition.calendar = calendar
definition.calendar = calendar
שורה 829: שורה 842:
local t1 = Date.newFromWikitext( parts[1] )
local t1 = Date.newFromWikitext( parts[1] )
local t2
local t2
local useCurrent = #parts<2 or (parts[2] == 'היום' or parts[2]=='הווה')
local useCurrent = #parts<2 or (parts[2] == 'היום' or parts[2]=='הווה' or parts[2]=='מתמשך')
if not useCurrent then
if not useCurrent then