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

אפדעיט
(nil איז נישט '')
(אפדעיט)
 
(3 מיטלסטע ווערסיעס פון איין אנדער באַניצער נישט געוויזן.)
שורה 77: שורה 77:
-- text to show if we have only end date. Example: "Last even - %s" where %s is time. nil - will not show end date
-- text to show if we have only end date. Example: "Last even - %s" where %s is time. nil - will not show end date
local onlyEndDateText = args['טקסט סיום']
local onlyEndDateText = args['טקסט סיום']
-- text to show if we have only start date. Example: "First even - %s" where %s is time. nil - will not show end date
local onlyStartDateText = args['טקסט התחלה']
 
local duration = args['משך'] --P2047
local duration = args['משך'] --P2047
-- Whether to show time diff between start and end day when applicable. Example: כן.
-- Whether to show time diff between start and end day when applicable. Example: כן.
שורה 108: שורה 110:
end
end


if endDate == '' or endDate == nil and wikidataEndDateLimit~=nil and wikidataEndDateLimit~='' then
-- if only start date available, we will add prefix prefixStartOnly otherwise will bound the end
if onlyStartDateText==nil and (endDate == '' or endDate == nil) and wikidataEndDateLimit~=nil and wikidataEndDateLimit~='' then
-- fallback
-- fallback
endDate, usingWikidataEndDate = WikidataSimpleFill(endDate, entityId, wikidataEndDateLimit )
endDate, usingWikidataEndDate = WikidataSimpleFill(endDate, entityId, wikidataEndDateLimit )
שורה 171: שורה 174:
end
end
elseif startDate ~= nil and (endDate==nil or (ongoingEvent and endDate~=nil))  then
elseif startDate ~= nil and (endDate==nil or (ongoingEvent and endDate~=nil))  then
if ongoingEvent then
if onlyStartDateText then
dateFormat = '%s–%s'
res = mw.ustring.format(onlyStartDateText, startDate)
if mw.ustring.match(startDate, ' ') or (endDate and mw.ustring.match(endDate, ' ')) then
else
dateFormat = '%s – %s'
if ongoingEvent then
dateFormat = '%s–%s'
if mw.ustring.match(startDate, ' ') or (endDate and mw.ustring.match(endDate, ' ')) then
dateFormat = '%s – %s'
end
res = mw.ustring.format(dateFormat, HStartDate or startDate, HEndDate or endDate or 'הווה')
-- try to fallback to automatic duration if duration is not available
if showTimeDiff == 'כן' and duration==nil then
local success, automaicDuration = pcall(Date.parseDateRange, startDate, diffFormat, true)
if success then duration = automaicDuration end
end
else
res = HStartDate or startDate
end
end
res = mw.ustring.format(dateFormat, HStartdate or startDate, HEnddate or endDate or 'הווה')
-- try to fallback to automatic duration if duration is not available
if showTimeDiff == 'כן' and duration==nil then
local success, automaicDuration = pcall(Date.parseDateRange, startDate, diffFormat, true)
if success then duration = automaicDuration end
end
else
res = HStartdate or startDate
end
end
elseif startDate~=nil and endDate~=nil  then
elseif startDate~=nil and endDate~=nil  then
שורה 190: שורה 197:
dateFormat = '%s – %s'
dateFormat = '%s – %s'
end
end
res = mw.ustring.format(dateFormat, HStartdate or startDate, HEndDate or endDate)
res = mw.ustring.format(dateFormat, HStartDate or startDate, HEndDate or endDate)
if showTimeDiff == 'כן' and duration==nil then
if showTimeDiff == 'כן' and duration==nil then
local success, automaicDuration = pcall(Date.parseDateRange, res, diffFormat, true)
local success, automaicDuration = pcall(Date.parseDateRange, startDate .. '-' .. endDate, diffFormat, true)
if success then duration = automaicDuration end
if success then duration = automaicDuration end
end
end