Jump to content

ଛାଞ୍ଚ:Dts/doc

ଉଇକିପିଡ଼ିଆ‌ରୁ

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

What it solves

[ସମ୍ପାଦନା]

Normally, for proper sorting, dates must be entered in YYYY-MM-DD format. However, that format does not conform to the for date display. This template automatically creates the hidden <span style="display:none">1776-07-04</span> for sorting purposes and then displays the date like this: July 4, 1776. To hide the output, use the {{dtsh}} template instead.

The year, month and day can either be entered separately or as a single date.
{{dts|year|month|day|BC}} {{dts|date}}
  • 1st parameter – Year (optional if month is given)
    • 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
  • 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 – Day (optional)
    • Day number – 7 or 07
  • 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.

  • 1st parameter – the full date in international, US or YYYY-MM-DD format
    • It uses {{#time:}} and so is limited to what the parser function can handle (e.g. it won't go beyond 100 AD).
    • International format is left as it is. YYYY-MM-DD format defaults to US format.
    • Abbreviated months are accepted.
    • Capitalisation and comma mistakes are corrected.

{{dts|year|month|day|BC}}

  • {{dts|1776|July|4}}

{{dts|date}}

  • {{dts|1776-07-04}}
  • {{dts|July 4, 1776}}
  • {{dts|4 July 1776}}

When supplying a single parameter for the date, it is accepted and interpreted according to the php date/time format, except that a single number is interpreted as a year. By default the date is shown as supplied. If the first parameter is not just the year, but no format parameter is supplied, due to a call of function #time the maximum number of calls of this template on a page is 1200.

Using format=mdy, format=dmy, or format=auto produces a format that depends on, but is not necessarily equal to the format of the supplied date. This requires multiple calls of function #time, reducing the maximum number of calls of this template on a page in the worst case to 88, see below.

Also see the examples below.

Output sent to table

  • <span style="display:none">01776-07-04</span> July 4, 1776 or
  • <span style="display:none">01776-07-04</span> 4 July 1776

Output displayed to user

  • July 4, 1776 or
  • 4 July 1776

The template formerly linked dates automatically. To turn linking off the parameter link=off was used. In accordance with current guidelines linking is no longer supported. Please do not use this parameter. Please remove it from existing transclusions.

Normal function of the template. The template with debug=yes, which causes hidden parts to appear:

ଛାଞ୍ଚ:Dts/examples

ଛାଞ୍ଚ:Dts/examples

Template:Dts/formauto calls #time with format strings with a total length of up to 68 characters. The worst case is when the default case of the #switch applies, e.g. for the format 1876-08-25. In that case the template can only be called 88 times (here less because of the other examples):

ଅଗଷ୍ଟ ୨୫, ୧୮୦୧; ଅଗଷ୍ଟ ୨୫, ୧୮୦୨; ଅଗଷ୍ଟ ୨୫, ୧୮୦୩; ଅଗଷ୍ଟ ୨୫, ୧୮୦୪; ଅଗଷ୍ଟ ୨୫, ୧୮୦୫; ଅଗଷ୍ଟ ୨୫, ୧୮୦୬; ଅଗଷ୍ଟ ୨୫, ୧୮୦୭; ଅଗଷ୍ଟ ୨୫, ୧୮୦୮; ଅଗଷ୍ଟ ୨୫, ୧୮୦୯; ଅଗଷ୍ଟ ୨୫, ୧୮୧୦; ଅଗଷ୍ଟ ୨୫, ୧୮୧୧; ଅଗଷ୍ଟ ୨୫, ୧୮୧୨; ଅଗଷ୍ଟ ୨୫, ୧୮୧୩; ଅଗଷ୍ଟ ୨୫, ୧୮୧୪; ଅଗଷ୍ଟ ୨୫, ୧୮୧୫; ଅଗଷ୍ଟ ୨୫, ୧୮୧୬; ଅଗଷ୍ଟ ୨୫, ୧୮୧୭; ଅଗଷ୍ଟ ୨୫, ୧୮୧୮; ଅଗଷ୍ଟ ୨୫, ୧୮୧୯; ଅଗଷ୍ଟ ୨୫, ୧୮୨୦; ଅଗଷ୍ଟ ୨୫, ୧୮୨୧; ଅଗଷ୍ଟ ୨୫, ୧୮୨୨; ଅଗଷ୍ଟ ୨୫, ୧୮୨୩; ଅଗଷ୍ଟ ୨୫, ୧୮୨୪; ଅଗଷ୍ଟ ୨୫, ୧୮୨୫; ଅଗଷ୍ଟ ୨୫, ୧୮୨୬; ଅଗଷ୍ଟ ୨୫, ୧୮୨୭; ଅଗଷ୍ଟ ୨୫, ୧୮୨୮; ଅଗଷ୍ଟ ୨୫, ୧୮୨୯; ଅଗଷ୍ଟ ୨୫, ୧୮୩୦; ଅଗଷ୍ଟ ୨୫, ୧୮୩୧; ଅଗଷ୍ଟ ୨୫, ୧୮୩୨; ଅଗଷ୍ଟ ୨୫, ୧୮୩୩; ଅଗଷ୍ଟ ୨୫, ୧୮୩୪; ଅଗଷ୍ଟ ୨୫, ୧୮୩୫; ଅଗଷ୍ଟ ୨୫, ୧୮୩୬; ଅଗଷ୍ଟ ୨୫, ୧୮୩୭; ଅଗଷ୍ଟ ୨୫, ୧୮୩୮; ଅଗଷ୍ଟ ୨୫, ୧୮୩୯; ଅଗଷ୍ଟ ୨୫, ୧୮୪୦; ଅଗଷ୍ଟ ୨୫, ୧୮୪୧; ଅଗଷ୍ଟ ୨୫, ୧୮୪୨; ଅଗଷ୍ଟ ୨୫, ୧୮୪୩; ଅଗଷ୍ଟ ୨୫, ୧୮୪୪; ଅଗଷ୍ଟ ୨୫, ୧୮୪୫; ଅଗଷ୍ଟ ୨୫, ୧୮୪୬; ଅଗଷ୍ଟ ୨୫, ୧୮୪୭; ଅଗଷ୍ଟ ୨୫, ୧୮୪୮; ଅଗଷ୍ଟ ୨୫, ୧୮୪୯; ଅଗଷ୍ଟ ୨୫, ୧୮୫୦; ଅଗଷ୍ଟ ୨୫, ୧୮୫୧; ଅଗଷ୍ଟ ୨୫, ୧୮୫୨; ଅଗଷ୍ଟ ୨୫, ୧୮୫୩; ଅଗଷ୍ଟ ୨୫, ୧୮୫୪; ଅଗଷ୍ଟ ୨୫, ୧୮୫୫; ଅଗଷ୍ଟ ୨୫, ୧୮୫୬; ଅଗଷ୍ଟ ୨୫, ୧୮୫୭; ଅଗଷ୍ଟ ୨୫, ୧୮୫୮; ଅଗଷ୍ଟ ୨୫, ୧୮୫୯; ଅଗଷ୍ଟ ୨୫, ୧୮୬୦; ଅଗଷ୍ଟ ୨୫, ୧୮୬୧; ଅଗଷ୍ଟ ୨୫, ୧୮୬୨; ଅଗଷ୍ଟ ୨୫, ୧୮୬୩; ଅଗଷ୍ଟ ୨୫, ୧୮୬୪; ଅଗଷ୍ଟ ୨୫, ୧୮୬୫; ଅଗଷ୍ଟ ୨୫, ୧୮୬୬; ଅଗଷ୍ଟ ୨୫, ୧୮୬୭; ଅଗଷ୍ଟ ୨୫, ୧୮୬୮; ଅଗଷ୍ଟ ୨୫, ୧୮୬୯; ଅଗଷ୍ଟ ୨୫, ୧୮୭୦; ଅଗଷ୍ଟ ୨୫, ୧୮୭୧; ଅଗଷ୍ଟ ୨୫, ୧୮୭୨; ଅଗଷ୍ଟ ୨୫, ୧୮୭୩; ଅଗଷ୍ଟ ୨୫, ୧୮୭୪; ଅଗଷ୍ଟ ୨୫, ୧୮୭୫; ଅଗଷ୍ଟ ୨୫, ୧୮୭୬; ଅଗଷ୍ଟ ୨୫, ୧୮୭୭; ଅଗଷ୍ଟ ୨୫, ୧୮୭୮; ଅଗଷ୍ଟ ୨୫, ୧୮୭୯; ଅଗଷ୍ଟ ୨୫, ୧୮୮୦; ଅଗଷ୍ଟ ୨୫, ୧୮୮୧; ଅଗଷ୍ଟ ୨୫, ୧୮୮୨; ଅଗଷ୍ଟ ୨୫, ୧୮୮୩; ଅଗଷ୍ଟ ୨୫, ୧୮୮୪; ଅଗଷ୍ଟ ୨୫, ୧୮୮୫; ଅଗଷ୍ଟ ୨୫, ୧୮୮୬; ଅଗଷ୍ଟ ୨୫, ୧୮୮୭; ଅଗଷ୍ଟ ୨୫, ୧୮୮୮; ଅସୁବିଧା: ଅତ୍ୟଧିକ #time ଡକରା ।

Error handling

[ସମ୍ପାଦନା]

During early 2009, Template:Dts generated month names for invalid month numbers, such as number 23 displaying "November". No warning is displayed, for the formatted page, that such invalid dates are being used on the page.

  • {{dtsh}}, hides the template's output
  • {{TBA}}, allows quarters, and allows sorting of time periods by end date.
  • m:Template:dts (backlinks, edit), since on Meta e.g. 09999 9999 induces numeric sort mode, "&" is prefixed to force string sort mode.
  • {{dts1}}
  • {{dts vgr}}, for video game release dates.
  • {{sort}}, sorting by a specified key
  • {{sortname}}, full name sorting.
  • {{tts}}, for sorting times in result tables of athletic events (only needed in certain cases - see template documentation)