Template:Dts

From Wikipedia, the free encyclopedia
Jump to: navigation, search
Documentation icon Template documentation[view] [edit] [history] [purge]

Dts stands for Date Table Sorting and is used to correctly sort and display dates in a sortable table (see Help:Sorting).

What it solves[change | change source]

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.

Parameters[change | change source]

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

Input[change | change source]

{{Dts|4|July|1776}}

See also the examples.

Output[change | change source]

Output sent to table

<span style="display:none">1776-07-04</span> [[July 4]] [[1776]]

Output displayed to user
00004-07-1776 July 1776 4

Related pages[change | change source]

Examples[change | change source]

Examples with debug=yes (hidden parts are made visible):

edit

Template syntax Date rendered
{{dts2|debug=yes|||9999}} 02014 2014
{{dts2|debug=yes|||-9999}} 02014 2014
{{dts2|debug=yes|4|July|-500}} 00004-07--500 July -500 4
{{dts2|debug=yes|4|July|-50}} 00004-07--50 July -50 4
{{dts2|debug=yes||July|-50}} 02014-07--50 July -50 2014
{{dts2|debug=yes|||-50}} 02014 2014
{{dts2|debug=yes|4|July|-5}} 00004-07--5 July -5 4
{{dts2|debug=yes|4|July|-9955}} 00004-07--9955 July -9955 4
{{dts2|debug=yes|4|July|-9555}} 00004-07--9555 July -9555 4
{{dts2|debug=yes|4|July|-9995}} 00004-07--9995 July -9995 4
{{dts2|debug=yes|4|July|500|BC}} -9996-07-500 July 500 4 BC
{{dts2|debug=yes|4|July|5000|BC}} -9996-07-5000 July 5000 4 BC
{{dts2|debug=yes|4|July|5|BC}} -9996-07-05 July 5 4 BC
{{dts2|debug=yes|4|July|9955|BC}} -9996-07-9955 July 9955 4 BC
{{dts2|debug=yes|4|July|9995|BC}} -9996-07-9995 July 9995 4 BC
{{dts2|debug=yes|4|July|9555|BC}} -9996-07-9555 July 9555 4 BC
{{dts2|debug=yes|4|July|40|BC}} -9996-07-40 July 40 4 BC
{{dts2|debug=yes||July|40|BC}} -7986-07-40 July 40 2014 BC
{{dts2|debug=yes|||40|BC}} -7986 2014 BC
{{dts2|debug=yes|4|July|60|BC}} -9996-07-60 July 60 4 BC
{{dts2|debug=yes|4|July|1|BC}} -9996-07-01 July 1 4 BC
{{dts2|debug=yes|3|July|0}} 00003-07-00 July 0 3
{{dts2|debug=yes|5|July|0}} 00005-07-00 July 0 5
{{dts2|debug=yes|4|July|9}} 00004-07-09 July 9 4
{{dts2|debug=yes|4|July|88}} 00004-07-88 July 88 4
{{dts2|debug=yes|4|July|1776}} 00004-07-1776 July 1776 4
{{dts2|debug=yes|9|4|1688}} 00009-04-1688 April 1688 9
{{dts2|debug=yes|09|04|1688}} 00009-04-1688 April 1688 9
{{dts2|debug=yes|11|7|2007}} 00011-07-2007 July 2007 11
{{dts2|debug=yes|4|june|776}} 00004-06-776 June 776 4
{{dts2|debug=yes|4|june|0776}} 00004-06-776 June 0776 4
{{dts2|debug=yes|4|june|1776}} 00004-06-1776 June 1776 4
{{dts2|debug=yes|11|sep|2001}} 00011-09-2001 September 2001 11
{{dts2|debug=yes||sep|2001}} 02014-09-2001 September 2001 2014
{{TBA|debug=yes|2001}} 02001-12-33
{{TBA|debug=yes|sortbefore=yes|2001}} 02001
{{dts2|debug=yes|||2001}} 02014 2014

The same examples with hidden parts actually hidden:

edit

Template syntax Date rendered
{{dts2|||9999}} 02014 2014
{{dts2|||-9999}} 02014 2014
{{dts2|4|July|-500}} 00004-07--500 July -500 4
{{dts2|4|July|-50}} 00004-07--50 July -50 4
{{dts2||July|-50}} 02014-07--50 July -50 2014
{{dts2|||-50}} 02014 2014
{{dts2|4|July|-5}} 00004-07--5 July -5 4
{{dts2|4|July|-9955}} 00004-07--9955 July -9955 4
{{dts2|4|July|-9555}} 00004-07--9555 July -9555 4
{{dts2|4|July|-9995}} 00004-07--9995 July -9995 4
{{dts2|4|July|500|BC}} -9996-07-500 July 500 4 BC
{{dts2|4|July|5000|BC}} -9996-07-5000 July 5000 4 BC
{{dts2|4|July|5|BC}} -9996-07-05 July 5 4 BC
{{dts2|4|July|9955|BC}} -9996-07-9955 July 9955 4 BC
{{dts2|4|July|9995|BC}} -9996-07-9995 July 9995 4 BC
{{dts2|4|July|9555|BC}} -9996-07-9555 July 9555 4 BC
{{dts2|4|July|40|BC}} -9996-07-40 July 40 4 BC
{{dts2||July|40|BC}} -7986-07-40 July 40 2014 BC
{{dts2|||40|BC}} -7986 2014 BC
{{dts2|4|July|60|BC}} -9996-07-60 July 60 4 BC
{{dts2|4|July|1|BC}} -9996-07-01 July 1 4 BC
{{dts2|3|July|0}} 00003-07-00 July 0 3
{{dts2|5|July|0}} 00005-07-00 July 0 5
{{dts2|4|July|9}} 00004-07-09 July 9 4
{{dts2|4|July|88}} 00004-07-88 July 88 4
{{dts2|4|July|1776}} 00004-07-1776 July 1776 4
{{dts2|9|4|1688}} 00009-04-1688 April 1688 9
{{dts2|09|04|1688}} 00009-04-1688 April 1688 9
{{dts2|11|7|2007}} 00011-07-2007 July 2007 11
{{dts2|4|june|776}} 00004-06-776 June 776 4
{{dts2|4|june|0776}} 00004-06-776 June 0776 4
{{dts2|4|june|1776}} 00004-06-1776 June 1776 4
{{dts2|11|sep|2001}} 00011-09-2001 September 2001 11
{{dts2||sep|2001}} 02014-09-2001 September 2001 2014
{{TBA|2001}} 02001-12-33
{{TBA|sortbefore=yes|2001}} 02001
{{dts2|||2001}} 02014 2014