Template:Years sinceEdit This Page

From FamilySearch Wiki

[view] [edit] [history] [purge] Documentation icon Template documentation


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}}}.

Contents

Usage

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

Parameters

Parameter name Description Default value required or optional?

parameter #1 (1) Year in between 0 and 2015. empty 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}}} 2015 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

Examples

Code Result
{{Years since|1950}} 65
{{Years since|error=0}} 0
{{Years since|x|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
  • This page was last modified on 12 March 2012, at 21:42.
  • This page has been accessed 262 times.