Wikisage is op 1 na de grootste internet-encyclopedie in het Nederlands. Iedereen kan de hier verzamelde kennis gratis gebruiken, zonder storende advertenties. De Koninklijke Bibliotheek van Nederland heeft Wikisage in 2018 aangemerkt als digitaal erfgoed.
- Wilt u meehelpen om Wikisage te laten groeien? Maak dan een account aan. U bent van harte welkom. Zie: Portaal:Gebruikers.
- Bent u blij met Wikisage, of wilt u juist meer? Dan stellen we een bescheiden donatie om de kosten te bestrijden zeer op prijs. Zie: Portaal:Donaties.
Sjabloon:Dts: verschil tussen versies
(http://en.wikipedia.org/w/index.php?title=Template:Dts&oldid=491015046) |
(Fixes) |
||
Regel 32: | Regel 32: | ||
|nowrap={{{nowrap|}}} | |nowrap={{{nowrap|}}} | ||
|format={{{format|}}} | |format={{{format|}}} | ||
}}</includeonly><noinclude> | }}</includeonly><noinclude> <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> | ||
'''{{PAGENAME}}''' stands for <big>'''D'''</big>ate <big>'''T'''</big>able <big>'''S'''</big>orting and is used to correctly sort and display dates in a sortable table (see [[Help:Sorting]]). | '''{{PAGENAME}}''' stands for <big>'''D'''</big>ate <big>'''T'''</big>able <big>'''S'''</big>orting and is used to correctly sort and display dates in a sortable table (see [[Help:Sorting]]). | ||
Regel 48: | Regel 48: | ||
{{!}}+The year, month and day can either be entered separately or as a single date. | {{!}}+The year, month and day can either be entered separately or as a single date. | ||
{{!}}- | {{!}}- | ||
!width=50% | !width=50%{{!}}{{tlf|dts|''year''|''month''|''day''|''BC''}} | ||
!width=50% | !width=50%{{!}}{{tlf|dts|''date''}} | ||
{{!}}-valign=top | {{!}}-valign=top | ||
{{!}} | {{!}} | ||
Regel 157: | Regel 157: | ||
[[Category:Sorting templates|Dts]] | [[Category:Sorting templates|Dts]] | ||
[[Category:Date mathematics templates|{{PAGENAME}}]] | [[Category:Date mathematics templates|{{PAGENAME}}]] | ||
</noinclude> |
Versie van 2 jul 2012 19:44
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
Normally, for proper sorting, dates must be entered in YYYY-MM-DD format. However, that format does not conform to the Manual of Style 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.
Parameters
{{dts|year|month|day|BC}} | {{dts|date}} |
---|---|
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
{{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
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
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
Linking
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.
Examples
Normal function of the template. | The template with debug=yes , which causes hidden parts to appear:
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Abbreviating the month name
The template displays the name of the month either in abbreviated form or fully spelt out. There are two ways of controlling which is used.
- Directly input the desired format.
- Use the
abbr
parameter.
Note that the method to use is determined by the input. The first method works wherever the second method fails and only in these cases. The following explains which method to use.
- All numeric input
If the month is input as a number, the default is to spell it out in full.
- {{
dts|2000-01-01
}} gives "januari 1, 2000" - {{
dts|2000|1|1
}} gives "januari 1, 2000"
In this case the month can be abbreviated by setting abbr
to on
.
- {{
dts|2000-01-01|abbr=on
}} gives "jan 1, 2000"
- {{
dts|2000|1|1|abbr=on
}} gives "jan 1, 2000"
- Entering a non-numeric month as the second unnamed parameter
The name of the month either in abbreviated form or fully spelt out when input as the second unnamed parameter. In either case the output form is equivalent to the input form.
- {{
dts|2000|January|1
}} gives "January 1, 2000"
- {{
dts|2000|Jan|1
}} gives "Jan 1, 2000"
- The whole date as a single parameter with a non-numeric month
The if the whole date is entered as a single parameter with a non-numeric month, the default is to display the date as input. In this case either abbreviate or fully spelt out he name of the month as desired.
- {{
dts|1 January 2000
}} gives "1 January 2000"
- {{
dts|1 Jan 2000
}} gives "1 Jan 2000"
Using the format
parameter overrides this default behaviour and the month name is spelt out in full by default. In this case the month can be abbreviated by setting abbr
to on.
- {{
dts|1 January 2000
|format=my}} gives "januari 2000"
- {{
dts|1 Jan 2000|format=my
}} gives "januari 2000"
- {{
dts|1 January 2000
|format=my|abbr=on}} gives "jan 2000"
- {{
dts|1 Jan 2000|format=my|abbr=on
}} gives "jan 2000"
Error handling
Entering an invalid date format will (generally) produce an error message such as the one below.
Error: 35 June 1900
This is not an acceptable date format. Please check the spelling, check the numbers and/or read the documentation at template {{dts}} for correct date input.
See also
- {{dtsh}}, hides the template's output
- {{TBA}}, allows quarters, and allows sorting of time periods by end date.
- 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)