Template:Years since

Dialog-warning-orange.svg Note: This template is used on a lot of pages. In order not to put too much load on the servers, edits should be kept to a bare minimum. Please discuss proposed changes on the talk page first.
  • Editing a template causes all pages that use the template to be re-rendered. If the template is used often, this can put a lot of load on the servers since it fills up the job queue.
  • Keep in mind that templates that are used on file description pages also show up on other wikis.
  • This page has been protected from editing to prevent vandalism. Only administrators can edit it. Get their attention by placing {{edit protected}} at the talk page.
Documentation icon Documentationviewedithistorypurge

This documentation is transcluded from Template:Years since/doc.

Function returning number of years since year {{{1}}}. The function is robust enough to survive various wrong inputs. Also user can control output to clip it to some range defined by {{{min}}} and {{{max}}} parameters. Also output can be rounded down to be multiple of parameter {{{mod}}}.


{{Years since |1= |mod= |min= |max= |error= }}

Template parameters

Parameter Description Default Status
1 Year in between 0 and 2016. 1670 required
mod Output can be rounded down to be multiple of parameter {{{mod}}} 1 optional
min minimum number possibly returned. Anything smaller will be set to {{{min}}} 0 optional
max maximum number possibly returned. Anything bigger will be set to {{{max}}} 2016 optional
error value returned in case of not a number input parameter {{{1}}}. empty string optional

Additional information

The template is intended to be used in the following namespaces: unknown

The template is intended to be used by the following user groups: no user group specified


Code Result
{{Years since|1950}} 66
{{Years since|error=0}} 0
{{Years since|x|error=0}} 0
{{Years since||error=0}} 0
{{Years since| 1000 |min=60 |max=100 |mod=10}} 100
{{Years since| 1923 |min=60 |max=100 |mod=10}} 90
{{Years since| 1941 |min=60 |max=100 |mod=10}} 70
{{Years since| 1942-1 |min=60 |max=100 |mod=10}} 70
{{Years since| 1999 |min=60 |max=100 |mod=10}} 60
{{Years since| x |min=60 |error=0}} 0
{{Years since| 1816 |max=200 |error=0}} 200