Jump to content

Template:Year2range/doc

From Wikipedia, the free encyclopedia

Usage

[edit]

This template takes a year in the form of a positive number of up to 4 digits and converts it to a range, thus :

  • {{Year2range|2024}} → 2024–25
  • {{Year2range|{{CURRENTYEAR}}}} → 2024–25
  • {{Year2range| {{#expr:2024+1}} }} → 2025–26
  • {{Year2range| {{#expr:2024-8}} }} → 2016–17
  • {{Year2range|1999}} → 1999–2000
  • {{Year2range|1899}} → 1899–1900
  • {{Year2range|999}} → 999–1000
  • {{Year2range|32}} → 32–33
  • {{Year2range|3}} → 3–4
  • {{Year2range|}}
  • {{Year2range|12345}}Error!! Template:Year2range expects a number of up to four digits.
  • {{Year2range|Nineteen Eighty Four}}Error!! Template:Year2range expects a number of up to four digits.
  • {{Year2range|-3}}Error!! Template:Year2range expects a number of up to four digits.

A second parameter can be used to specify the size of the range, with a default of 1 year if omitted :

  • {{Year2range|1997|8}} → 1997–2005
  • {{Year2range|2024|5}} → 2024–29
  • {{Year2range|2024|-5}} → 2024–19
  • {{Year2range|2024|1}} → 2024–25
  • {{Year2range|2024}} → 2024–25

This template will often be used with {{Title year}}, {{Title year+1}} and {{Title year-1}} and dedicated templates are provided for these cases.

See also

[edit]