Template:AgeFull: Difference between revisions
Jump to navigation
Jump to search
(existing code from WP's template "How long ago", formatted for readability, but with extant bugs) |
(whoops, well that was a waste of time, here's a better version I just found) |
||
Line 1: | Line 1: | ||
{{ | {{#if:{{{year|}}} | ||
| | |{{#if:{{{month|}}} | ||
{{# | |{{#if:{{{day|}}} | ||
|{{For year month day/display | |||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}-{{#ifexpr:{{CURRENTMONTH}}>{{{month}}} | |||
|0 | |||
|{{#ifexpr:{{CURRENTMONTH}}<{{{month}}} | |||
|1 | |||
|{{#ifexpr:{{CURRENTDAY}}>={{{day}}} | |||
|0 | |||
|1 | |||
}} | |||
}} | |||
}}}} | |||
|months={{#expr:{{CURRENTMONTH}}-{{{month}}}+{{#ifexpr:{{CURRENTDAY}}>={{{day}}} | |||
|{{#ifexpr:{{CURRENTMONTH}}>={{{month}}} | |||
|0 | |||
| | |12 | ||
}} | |||
|{{#ifexpr:{{CURRENTMONTH}}>{{{month}}} | |||
|-1 | |||
|11 | |||
}} | |||
}}}} | |||
|days={{#ifexpr:{{CURRENTDAY}}>={{{day}}} | |||
| | |{{#expr:{{CURRENTDAY}}-{{{day}}} | ||
{{#expr:{{ | }} | ||
|{{#expr:{{Gregorian serial date | |||
|year={{CURRENTYEAR}} | |||
|month={{CURRENTMONTH}} | |||
|day={{CURRENTDAY}}}}-{{Gregorian serial date | |||
|year={{CURRENTYEAR}} | |||
|month={{#expr:{{CURRENTMONTH}}-1}} | |||
|day={{{day}}} | |||
}}}} | |||
}} | |||
}} | }} | ||
|{{#ifexpr:{{CURRENTMONTH}}={{{month}}} | |||
|{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | |||
| | |0 years | ||
{{#ifexpr: | |{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} or {{For year month day/display | ||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | |||
}} | |||
}} | |||
|{{#ifexpr:{{CURRENTMONTH}}>{{{month}}} | |||
|{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | |||
|<!--null value--> | |||
|{{For year month day/display | |||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | |||
}} and | |||
}} {{#expr:{{CURRENTMONTH}}-{{{month}}}-1}} or {{For year month day/display | |||
|months={{#expr:{{CURRENTMONTH}}-{{{month}}}}} | |||
}} | |||
| | |||
{{#ifexpr: | |||
}} | }} | ||
|{{#ifexpr:{{CURRENTYEAR}}={{#expr:{{{year}}}+1}} | |||
|<!--null value--> | |||
|{{For year month day/display | |||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} | |||
}} and | |||
}} {{#expr:{{CURRENTMONTH}}-{{{month}}}+11}} or {{#expr:{{CURRENTMONTH}}-{{{month}}}+12}} months | |||
}} | |||
}} | |||
}} | |||
|{{#ifexpr:{{CURRENTYEAR}}={{{year}}} | |||
|0 years | |||
|{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}} or {{For year month day/display | |||
|years={{#expr:{{CURRENTYEAR}}-{{{year}}}}} | |||
}} | }} | ||
}} | |||
}} | }} | ||
|some time | |||
}} | }} |
Revision as of 16:59, 12 June 2013
some time