Template:En dash range/sandbox
Appearance
{{{1}}}–{{{2}}}
This is the template sandbox page for Template:En dash range (diff). See also the companion subpage for test cases. |
This template uses Lua: |
This template is used on approximately 197,000 pages. To avoid major disruption and server load, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Consider discussing changes on the talk page before implementing them. |
This template creates a en dash-separated range that is compliant with MOS:RANGE. Its main purpose is to automatically determine whether a spaced or unspaced dash is to be used, based on the presence of whitespace, hyphens, or dashes in either term.
Usage
[edit]{{En dash range|start|end}}
Examples:
{{En dash range|2020|2021}}
: 2020–2021{{En dash range|2020|present}}
: 2020–present{{En dash range|1 January 2020|1 January 2021}}
: 1 January 2020 – 1 January 2021{{En dash range|1 January 2020|present}}
: 1 January 2020 – present{{En dash range|1 January 2020|2021}}
: 1 January 2020 – 2021{{En dash range|2020|1 January 2021}}
: 2020 – 1 January 2021{{En dash range|2020-01-01|2021-01-01}}
: 2020-01-01 – 2021-01-01{{En dash range|2020|2021<ref>...</ref>}}
: 2020–2021[1]