Last edited 2 years ago
by Demo writer

Module:IndicatorProcess and Property:IncidentDate: Difference between pages

(Difference between pages)
m (1 revision imported)
 
hw>Mlink-rodrigue
No edit summary
 
Line 1: Line 1:
local p = {} -- p stands for package
This is a property of type [[Has type::Date]].
 
* [[Has preferred property label::Incident date@en]]
function p.forDate( frame )
* [[Has preferred property label::Vorfalldatum@de]]
    local todayU = frame:callParserFunction( '#time:U' )
    local soonU = frame:callParserFunction( '#time:U', '+2 months' )
    local timeU = frame:callParserFunction( '#time:U', frame.args[1] )
    local color = 'green'
    if ( timeU < soonU ) then
    color = 'orange'
    end
    if ( timeU < todayU ) then
    color = 'red'
    end
    return p.getIndicator( frame, color )
end
 
function p.getIndicator( frame, color )
-- adding the color in hidden text makes the indicator sortable in tables
    return "<span class='date-indicator' style='color: " .. color .. ";font-size:1em;'>&#9673;<span style='display:none;'>" .. color .. "</span></span>";
end
 
return p

Revision as of 09:25, 4 October 2021

This is a property of type Date.

  • Incident date (en)
  • Vorfalldatum (de)
No categories assignedEdit

Discussions