בדוקי עריכות אוטומטית, אינטערפעיס רעדאקטארן, אינטערפעיס אדמיניסטראַטאָרן, סיסאפן, מייבאים, מעדכנים, מייבא, אספקלריה רעדאקטארן
46,368
רעדאגירונגען
ק (הגהה) |
(אפדעיט) |
||
| (5 מיטלסטע ווערסיעס פון איין אנדער באַניצער נישט געוויזן.) | |||
| שורה 52: | שורה 52: | ||
local pointInTime = args['נקודת זמן'] | local pointInTime = args['נקודת זמן'] | ||
local startDate = args['תאריך התחלה'] | local startDate = args['תאריך התחלה'] | ||
local HStartDate | |||
if startDate ~= nil and isHDate(startDate) then | if startDate ~= nil and isHDate(startDate) then | ||
HStartDate = startDate | |||
local success, sepcDate = pcall(HDate.pick, mw.getCurrentFrame():newChild{ args = {hebrew=startDate, world='', exact='כן' } }) | local success, sepcDate = pcall(HDate.pick, mw.getCurrentFrame():newChild{ args = {hebrew=startDate, world='', exact='כן' } }) | ||
if success and sepcDate ~= '' then | if success and sepcDate ~= '' then | ||
| שורה 59: | שורה 61: | ||
end | end | ||
local endDate = args['תאריך סיום'] | local endDate = args['תאריך סיום'] | ||
local HEndDate | |||
if endDate ~= nil and isHDate(endDate) then | if endDate ~= nil and isHDate(endDate) then | ||
HEndDate = endDate | |||
local success, sepcDate = pcall(HDate.pick, mw.getCurrentFrame():newChild{ args = {hebrew=endDate, world='', exact='כן' } }) | local success, sepcDate = pcall(HDate.pick, mw.getCurrentFrame():newChild{ args = {hebrew=endDate, world='', exact='כן' } }) | ||
if success and sepcDate ~= '' then | if success and sepcDate ~= '' then | ||
| שורה 73: | שורה 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: כן. | ||
| שורה 104: | שורה 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 ) | ||
| שורה 167: | שורה 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 | ||
res = mw.ustring.format(onlyStartDateText, startDate) | |||
else | |||
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 | ||
end | end | ||
elseif startDate~=nil and endDate~=nil then | elseif startDate~=nil and endDate~=nil then | ||
| שורה 186: | שורה 197: | ||
dateFormat = '%s – %s' | dateFormat = '%s – %s' | ||
end | end | ||
res = mw.ustring.format(dateFormat, startDate, 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, | local success, automaicDuration = pcall(Date.parseDateRange, startDate .. '-' .. endDate, diffFormat, true) | ||
if success then duration = automaicDuration end | if success then duration = automaicDuration end | ||
end | end | ||
רעדאגירונגען