Template:Dts2/doc
From Wikipedia, the free encyclopedia
Dts2/doc stands for Date Table Sorting and is used to correctly sort and display dates in a sortable table (see Help:Sorting).
Contents |
[edit] What it solves
Normally, for proper sorting dates must be entered in YYYY-MM-DD format. But this does not conform to the Manual of Style for date display and wikilinking.
This template automatically creates the hidden <span style="display:none">1776-07-04</span>
for sorting purposes and then displays and wikilinks the date properly like this July 4, 1776, depending on the user's Special:Preferences.
[edit] Parameters
- 1st parameter - Day (optional)
- Day number - 7 or 07
- 2nd parameter - Month (optional if the day is not given either)
- Full month name - February or february
- Abbreviated month name - Feb or feb
- Month number - 2 or 02
- 3rd parameter - Year
- Year number - number in the range -9999 through 9999: the numbers -9999 through 0 are used without "bc" and represent astronomical years -9999 through 0, the numbers 1 through 9999 represent that year AD, or BC with the fourth parameter set to bc or BC
- 4th parameter - optional with value BC or bc
- Used with a positive year number
Thus e.g. for the year 5 BC we can use "5|bc" or "-4".
A time period (year or month and year) is sorted according to its start, and time periods with the same starting moment are in order of descending length: a year comes before its first month; a month comes before its first day.
[edit] Input
{{dts2|4|July|1776}}
See also the examples.
[edit] Output
Output sent to table
<span style="display:none">1776-07-04</span> [[July 4]] [[1776]]
Output displayed to user
4 July 1776
[edit] See also
- Template:TBA (backlinks, edit) - allows quarters, and allows sorting of time periods by end date.
- m:Template:dts2 (backlinks, edit) - since on Meta e.g. 09999 9999 induces numeric sort mode, "&" is prefixed to force string sort mode
[edit] Examples
Examples with debug=yes (hidden parts are made visible):
Template syntax | Date rendered |
---|---|
{{dts2|debug=yes|||9999}} | 09999 9999 |
{{dts2|debug=yes|||-9999}} | -0000 10000 BC |
{{dts2|debug=yes|4|July|-500}} | -9499-07-04 4 July 501 BC |
{{dts2|debug=yes|4|July|-50}} | -9949-07-04 4 July 51 BC |
{{dts2|debug=yes||July|-50}} | -9949-07 July 51 BC |
{{dts2|debug=yes|||-50}} | -9949 51 BC |
{{dts2|debug=yes|4|July|-5}} | -9994-07-04 4 July 6 BC |
{{dts2|debug=yes|4|July|-9955}} | -0044-07-04 4 July 9956 BC |
{{dts2|debug=yes|4|July|-9555}} | -0444-07-04 4 July 9556 BC |
{{dts2|debug=yes|4|July|-9995}} | -0004-07-04 4 July 9996 BC |
{{dts2|debug=yes|4|July|500|BC}} | -9500-07-04 4 July 500 BC |
{{dts2|debug=yes|4|July|5000|BC}} | -5000-07-04 4 July 5000 BC |
{{dts2|debug=yes|4|July|5|BC}} | -9995-07-04 4 July 5 BC |
{{dts2|debug=yes|4|July|9955|BC}} | -0045-07-04 4 July 9955 BC |
{{dts2|debug=yes|4|July|9995|BC}} | -0005-07-04 4 July 9995 BC |
{{dts2|debug=yes|4|July|9555|BC}} | -0445-07-04 4 July 9555 BC |
{{dts2|debug=yes|4|July|40|BC}} | -9960-07-04 4 July 40 BC |
{{dts2|debug=yes||July|40|BC}} | -9960-07 July 40 BC |
{{dts2|debug=yes|||40|BC}} | -9960 40 BC |
{{dts2|debug=yes|4|July|60|BC}} | -9940-07-04 4 July 60 BC |
{{dts2|debug=yes|4|July|1|BC}} | -9999-07-04 4 July 1 BC |
{{dts2|debug=yes|3|July|0}} | -9999-07-03 3 July 1 BC |
{{dts2|debug=yes|5|July|0}} | -9999-07-05 5 July 1 BC |
{{dts2|debug=yes|4|July|9}} | 00009-07-04 4 July 9 |
{{dts2|debug=yes|4|July|88}} | 00088-07-04 4 July 88 |
{{dts2|debug=yes|4|July|1776}} | 01776-07-04 4 July 1776 |
{{dts2|debug=yes|9|4|1688}} | 01688-04-09 9 April 1688 |
{{dts2|debug=yes|09|04|1688}} | 01688-04-09 09 April 1688 |
{{dts2|debug=yes|11|7|2007}} | 02007-07-11 11 July 2007 |
{{dts2|debug=yes|4|june|776}} | 00776-06-04 4 June 776 |
{{dts2|debug=yes|4|june|0776}} | 00776-06-04 4 June 776 |
{{dts2|debug=yes|4|june|1776}} | 01776-06-04 4 June 1776 |
{{dts2|debug=yes|11|sep|2001}} | 02001-09-11 11 September 2001 |
{{dts2|debug=yes||sep|2001}} | 02001-09 September 2001 |
{{TBA|debug=yes|2001}} | 02001-12-33 |
{{TBA|debug=yes|sortbefore=yes|2001}} | 02001 |
{{dts2|debug=yes|||2001}} | 02001 2001 |
The same examples with hidden parts actually hidden:
Template syntax | Date rendered |
---|---|
{{dts2|||9999}} | 9999 |
{{dts2|||-9999}} | 10000 BC |
{{dts2|4|July|-500}} | 4 July 501 BC |
{{dts2|4|July|-50}} | 4 July 51 BC |
{{dts2||July|-50}} | July 51 BC |
{{dts2|||-50}} | 51 BC |
{{dts2|4|July|-5}} | 4 July 6 BC |
{{dts2|4|July|-9955}} | 4 July 9956 BC |
{{dts2|4|July|-9555}} | 4 July 9556 BC |
{{dts2|4|July|-9995}} | 4 July 9996 BC |
{{dts2|4|July|500|BC}} | 4 July 500 BC |
{{dts2|4|July|5000|BC}} | 4 July 5000 BC |
{{dts2|4|July|5|BC}} | 4 July 5 BC |
{{dts2|4|July|9955|BC}} | 4 July 9955 BC |
{{dts2|4|July|9995|BC}} | 4 July 9995 BC |
{{dts2|4|July|9555|BC}} | 4 July 9555 BC |
{{dts2|4|July|40|BC}} | 4 July 40 BC |
{{dts2||July|40|BC}} | July 40 BC |
{{dts2|||40|BC}} | 40 BC |
{{dts2|4|July|60|BC}} | 4 July 60 BC |
{{dts2|4|July|1|BC}} | 4 July 1 BC |
{{dts2|3|July|0}} | 3 July 1 BC |
{{dts2|5|July|0}} | 5 July 1 BC |
{{dts2|4|July|9}} | 4 July 9 |
{{dts2|4|July|88}} | 4 July 88 |
{{dts2|4|July|1776}} | 4 July 1776 |
{{dts2|9|4|1688}} | 9 April 1688 |
{{dts2|09|04|1688}} | 09 April 1688 |
{{dts2|11|7|2007}} | 11 July 2007 |
{{dts2|4|june|776}} | 4 June 776 |
{{dts2|4|june|0776}} | 4 June 776 |
{{dts2|4|june|1776}} | 4 June 1776 |
{{dts2|11|sep|2001}} | 11 September 2001 |
{{dts2||sep|2001}} | September 2001 |
{{TBA|2001}} | 2001 |
{{TBA|sortbefore=yes|2001}} | 2001 |
{{dts2|||2001}} | 2001 |