Template:Years since: Difference between revisions
Template page
More actions
←Created page with '{{#switch:1 |<!-- a -->{{#if: {{{1|}}} |0|1}} = {{error|}} |<!-- b -->{{IfNum| {{{1|}}} |0|1}} ...' |
No edit summary |
||
| Line 1: | Line 1: | ||
{{# | <!-- Cases: | ||
a) empty string -> {{error|}} | |||
| | b) not a number -> {{error|}} | ||
| | c) more than max -> max | ||
| | d) less than min -> min | ||
| | e) number inbetween min and max. {{#expr: trunc( ({{CURRENTYEAR}}-{{{1}}}) / {{{mod|1}}}) * {{{mod|1}}} }} calculates number of years since {{{1}}} rounded down to a multiple of mod | ||
-->{{#switch:1 | |||
|{{#if: {{{1|}}} |0|1}} = {{error|}} | |||
|{{IfNum| {{{1}}} |0|1}} = {{error|}} | |||
|{{#expr: {{CURRENTYEAR}}-{{{1}}} > {{{max|{{CURRENTYEAR}} }}} }} = {{{max|{{CURRENTYEAR}} }}} | |||
|{{#expr: {{CURRENTYEAR}}-{{{1}}} < {{{min|0}}} }} = {{{min|0}}} | |||
|#default = {{#expr: trunc( ({{CURRENTYEAR}}-{{{1}}}) / {{{mod|1}}}) * {{{mod|1}}} }} | |||
}}<noinclude> | }}<noinclude> | ||
{{Documentation}} | {{Documentation}} | ||
</noinclude> | </noinclude> | ||