Jump to content

Template:Sort date range: Difference between revisions

<translate> {{<tvar name=1>PLURAL:1</tvar>|shortcut|shortcuts}}:</translate> {{sdrTemplate:sdr}}
From NicheWork
w>HouseBlaster
m HouseBlaster moved page Template:Sdr to Template:Sort date range: expand template name per WP:TPN
 
m 1 revision imported
 
(No difference)

Latest revision as of 13:40, 19 January 2026

Template documentation


This template is used to create a table cell with a date range that will sort correctly based on the first parameter (the "from" date). A line break is inserted before the "to" date unless a third parameter is given (any value will work).

Usage

{{Sort date range |from_date |to_date [|y] }}

Examples

  • This code: {{Sort date range|April 1, 2016|March 31, 2018}}
    produces: data-sort-value="April 1, 2016" | April 1, 2016 –
    March 31, 2018
  • This code: {{Sort date range|April 1, 2016|March 31, 2018|y}}
    produces: data-sort-value="April 1, 2016" | April 1, 2016 – March 31, 2018
  • This code:
{| class="wikitable sortable"
! Name
! In office
! Party
|-
| Bob
| {{Sdr|May 1, 2016|April 30, 2018}}
| Yes!
|-
| (Vacant)
| {{Sdr|May 1, 2018|May 31, 2018}}
| &ndash;
|-
| Fred
| {{Sdr|June 1, 2018|April 30, 2020}}
| No!
|}
produces:
Name In office Party
Bob May 1, 2016 –
April 30, 2018
Yes!
(Vacant) May 1, 2018 –
May 31, 2018
Fred June 1, 2018 –
April 30, 2020
No!