Jump to content

Template talk:Date table sorting: Difference between revisions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
Content deleted Content added
m →‎Y10K support?: struck from
Line 261: Line 261:


I noticed <strike>from</strike> the [[:Template:Dts#Examples|examples]] in documentation have years starting with 0, from which I inferred support for display of the [[Year 10,000 problem|year 10,000]] and beyound. Is this true? -[[User:Mardus|Mardus]] ([[User talk:Mardus|talk]]) 02:11, 27 October 2013 (UTC)
I noticed <strike>from</strike> the [[:Template:Dts#Examples|examples]] in documentation have years starting with 0, from which I inferred support for display of the [[Year 10,000 problem|year 10,000]] and beyound. Is this true? -[[User:Mardus|Mardus]] ([[User talk:Mardus|talk]]) 02:11, 27 October 2013 (UTC)

== German table error ==

Extremely unfortunate that this feature is totally incompatible with German WP tables that use dts coded with year at the end!
* "dts|17|10|2002"
Error: 17 10 2002
This is not an acceptable date format. Please check the spelling, check the numbers and/or read the documentation at template
-[[Special:Contributions/71.174.188.43|71.174.188.43]] ([[User talk:71.174.188.43|talk]]) 15:47, 17 January 2014 (UTC)

Revision as of 15:47, 17 January 2014

More precise time listing than 'dts' command

Hey everyone! Is it possible to have a more precise listing of date than YYYY-MM-DD? I'm looking at the ISO date format page, and wondering if YYYY-MM-DD HH:MM:SS is somehow permitted in Wikipedia.

Thanks! MakeItProper (talk) 21:29, 17 August 2012 (UTC)[reply]

simpler way?

Wouldn't this accomplish the same thing?

{{nk|{{date|{{{1}}}|iso}}|{{date|{{{1}}}}}}}

~ 10nitro (talk) 20:15, 3 January 2010 (UTC)[reply]

Yeah, with a little tweaking it can be done. Gary King (talk) 05:23, 4 January 2010 (UTC)[reply]

How about "October 2005"

If the template can display just the year "2005", how about displaying month/year? "October 2005". Any way to do that? Also it would have been nice if all the code was in one template for easily reproducing this on another wiki. --Justpassingthrough2 (talk) 17:14, 20 February 2010 (UTC)[reply]

It can do October 2005. JIMp talk·cont 10:38, 9 January 2011 (UTC)[reply]
When I enter a code {{dts|format=y|1992|2|7}} it doesn't format the output properly. Can you update "format" values to display onyl the year-value ? -Paul
{{dts|1992}} (output: 1992) will do what you want, to display only the year. Gary King (talk · scripts) 19:05, 25 February 2011 (UTC)[reply]

Difference?

What is the difference between this template and {{Start date}}? Erik (talk) 22:33, 10 March 2010 (UTC)[reply]

This template is used to enter dates into tables so that they are sortable. Gary King (talk) 22:36, 10 March 2010 (UTC)[reply]
Which should be used in the "released" field of a film's infobox, then? The infobox documentation mentions only "Start date". Erik (talk) 22:39, 10 March 2010 (UTC)[reply]
{{start date}}, not this one. Gary King (talk) 22:46, 10 March 2010 (UTC)[reply]
Thanks. I didn't want to continue without knowing for sure. Happy editing! Erik (talk) 22:52, 10 March 2010 (UTC)[reply]

#time limit

This isn't a problem with {{dts}}, but it may be interesting to other users of {{dts}}: There is apparently a limit to the number of occurrences of #time in a single wiki page. I reported the problem to MediaWiki here: http://www.mediawiki.org/wiki/Help_talk:Extension:ParserFunctions#.23time_limit (click the link for more details). This means large sortable tables (i.e. more than 100 rows) should use the {{dts|yyyy|mm|dd}} format instead of {{dts|yyyy-mm-dd}} format. Johnson487682 (talk) 14:36, 15 June 2010 (UTC)[reply]

Template output?

According to dts documentation, {{dts|2010-07-04}} output should be U.S. "July 4, 2010". But in Wikipedia in culture the output of dts appears to always be yyyy-mm-dd. Is this a bug? --Lexein (talk) 08:52, 9 January 2011 (UTC)[reply]

Fixed. JIMp talk·cont 10:35, 9 January 2011 (UTC)[reply]

Time interval

Is it possible to enter a time interval such as January 11–15 and have it sort by the first (or last) date, i.e. as "January 11" or "January 15"? bamse (talk) 20:20, 26 February 2011 (UTC)[reply]

The template doesn't do this at the moment. For now, you can use {{sort}}. Gary King (talk · scripts) 05:38, 27 February 2011 (UTC)[reply]
Thanks for the reply. I went with {{dtsh}} and typing the interval after it (without template). bamse (talk) 08:14, 27 February 2011 (UTC)[reply]
I suppose that "dtsh" and "dts" add the same kind of hidden sort code, correct? bamse (talk) 08:15, 27 February 2011 (UTC)[reply]
Yep Gary King (talk · scripts) 19:15, 27 February 2011 (UTC)[reply]

Conflict with Skype

Please see Wikipedia:Village pump (technical)#Skype problem - processesing "invisible" text. Thanks, Rambo's Revenge (talk) 12:10, 27 May 2011 (UTC)[reply]

International dating

Wouldn't it be more appropriate to have the default format as international dating rather than American dating? Is this determined by the template or is it entirely based on user preferences? McLerristarr | Mclay1 02:28, 28 June 2011 (UTC)[reply]

Template default is MDY. There is an option to change it to DMY. Gary King (talk · scripts) 02:41, 28 June 2011 (UTC)[reply]
Hence my first question. McLerristarr | Mclay1 02:49, 28 June 2011 (UTC)[reply]
Not sure whether it's more appropriate. A related question would be whether it's worth changing it and then going through every article that transcludes this template to ensure that they are using the correct format, since by now most people using this template assume that it outputs in MDY. Gary King (talk · scripts) 02:54, 28 June 2011 (UTC)[reply]

text browsers

Wikipedia is the first site in the world to create such horrible looking dates in text browsers. Keep your zeros to yourselves. Jidanni (talk) 03:34, 9 July 2011 (UTC)[reply]

They are a side effect of the sorting templates that are needed to aid table sorting at the moment. Soon they will no longer be required (due to a new sorting technology) and then it shouldn't bother you anymore. —TheDJ (talkcontribs) 09:54, 14 July 2011 (UTC)[reply]

Two entries with same date

Is there a way to force one row before the other when they have the same date? The table has two entries defined by {{Dts|2011|06|23}}, but one should still be shown before the other, which currently shows up wrong in old-new order (but correct for new-old order). I tried {{Sort|2011-06-23-[1 and 2]|June 23, 2011}} and without the last dash, but that doesn't seem to work, in fact they don't show up between the other dates, they just show up at the bottom of the page. Anyone have some solution? Thanks. Xeworlebi (talk) 01:29, 30 July 2011 (UTC)[reply]

Possible bug

This may be of interest. {{dts|869-07-09}} produces "July 9, 0869", with a leading zero as seen here. jonkerz 08:55, 24 August 2011 (UTC)[reply]

Two more apparent bugs show up in the List of epidemics—first, the pre-1000 AD date ranges have a space after the en dash ("–"; e.g. "165– 180"). Second, there is no space between the numbers and "BC" (e.g., "1650BC– 1550BC"). I tried to figure out the syntax, but I can't make heads or tails of how to fix those two bugs. Note that these appear in both Firefox 2.0.0.20 and Safari 1.3.2—DocWatson42 (talk) 09:52, 29 August 2011 (UTC)[reply]
{{dts|869-07-09}} is fixed. JIMp talk·cont 11:59, 27 April 2012 (UTC)[reply]

Hidden year

Is it possible to create and add a new format with hidden year? For example:

Input: {{dts|format=md|2010|March|29}}
Output: <span style="display:none">02010-03-29</span> March 29
Display: March 29

This format would be very useful in a table where all the dates are from one or two different years and the listing of years looks excessive. For example: in this table, all the dates are either in 2010 or 2011 (i.e. between July 2010 and June 2011) and listing the years would be a little bit redundant as the article title already mentions the years. Right now that table uses {{dts}} templates without year such as: {{dts||March|29}}. However it produces <span style="display:none">02012-03-29</span> March 29 and the entry will be sorted as March 29, 2012, which will create incorrect sorting in the table. — MT (talk) 06:39, 29 March 2012 (UTC)[reply]

This is now working.
{{dts|format=md|March 29, 2010}}
Note that the date is written as one parameter in normal format. JIMp talk·cont 23:40, 23 April 2012 (UTC)[reply]
This is now working too.
{{dts|format=md|2010|March|29}}
JIMp talk·cont 09:05, 24 April 2012 (UTC)[reply]

Inconsistant sorting codes for BC

I've just discovered that years BC are not being coded correctly. The sorting code is out by 1 depending on whether the BC year is specified using BC or by a negative year. Worse is the case of using BCE, which is simply ignored.

  • {{dts|-2000|July|1}} gives -7999-07-01
  • {{dts|2000|July|1|BC}} gives -8000-07-01
  • {{dts|2000|July|1|BCE}} gives 02000-07-01

JIMp talk·cont 00:28, 25 April 2012 (UTC)[reply]

Actually, just rediscovered it. I'd found it three years ago but thought it might have been done on purpose. I can't think of any purpose though. JIMp talk·cont 01:53, 25 April 2012 (UTC)[reply]

Abbreviate by default

I'm working on a rewrite of the template to fix the problems mentioned above (plus some not mentioned). Besides fixing problems, though, what I'm also planning on is making the template default to abbreviating the month name. This template is used in tables where space is often tight and alignment is preferable. It is now possible to force the template to abbreviate the month & I've often done so but it means a little extra typing. It seems to me we'd be better off reversing this; let those who want the month name spelt out in full do the extra work. JIMp talk·cont 05:31, 27 April 2012 (UTC)[reply]

New version

I've put the new code in place as mentioned above. Besides fixing the problems mentioned above it also makes the hidden code consistant, gets rid of false dates (e.g. outputting the current day of the month when it wasn't input) and allows dm, md, my, d, m & y formats in addition to mdy & dmy. I believe it'll also allow more transclusions (less code ... looks like more but it's actually less (not calling {{MONTHNAME}}, {{MONTHNUMBER}}, etc.)). JIMp talk·cont 12:09, 27 April 2012 (UTC)[reply]

The alterations seem great, nice work. However, I'm not entirely convinced that the month names need to abbreviated by default. While I see your point about the issue of space, I personally worry whether reducing all month names to just three letters would suggest a lack of professionalism that, as an encyclopaedia, we need to avoid. It makes sense for an editor to have the option to abbreviate the month names, but could this not be achieved through an optional parameter? A Thousand Doors (talk | contribs) 01:25, 28 April 2012 (UTC)[reply]
Abbreviating month names by default is an absolutely horrible idea. Like the user above, I agree that is looks unprofessional, and would be better installed as an optional parameter, rather than the default output. Canuck89 (converse with me) 05:58, 28 April 2012 (UTC)[reply]
In addition, the changed code has caused a complete breakdown in some tables, such as those listed at List of Presidents of Israel by longevity, which looked fine under the previous version. Canuck89 (have words with me) 06:27, 28 April 2012 (UTC)[reply]
It appears that this has caused a breakdown across many of our FLs, I'm not sure what the fix is, but check List of international cricket five-wicket hauls by Anil Kumble for one example (many of the FLs in the category have the same problem). —SpacemanSpiff 07:29, 28 April 2012 (UTC)[reply]
The new template seems to force a new line after it, so that where a date is immediately followed by a reference or comment, the reference/comment is now below the date - making tables longer and scruffier. See Costa Rica and Albania in International recognition of Kosovo#UN member states for example. Bazonka (talk) 07:47, 28 April 2012 (UTC)[reply]
I would just like to see the month abbreviations set as an optional parameter, as I think the abbreviations look ugly as a default. Canuck89 (click here!) 09:25, 28 April 2012 (UTC)[reply]
The abbreviations stink. How can one guy just go and change it without first trying to reach a consensus among users?TheFBH (talk) 21:01, 28 April 2012 (UTC)[reply]
As this template is used on over 10,000 articles consensus should be gained before changing the functionality for existing pages. Please gain consensus or change to operate as the previous version. Keith D (talk) 15:25, 29 April 2012 (UTC)[reply]

Revert until consensus is demonstrated. The Rambling Man (talk) 17:12, 30 April 2012 (UTC)[reply]

Months spelt in full, some long, some short, taking up a whole lot of room, this is what seems to me unprofessional. Perhaps I'm in the minority. I'm reversing this change. That's the easy part. I'm more interested in errors we seem to be getting. JIMp talk·cont 23:27, 30 April 2012 (UTC)[reply]

hidden Error:Invalid time

I created Category:Pages with parser function time errors and added it to the interface page so it is automatically populated. It took me a while to figure out that this template hides the error message under certain circumstances:

Markup Renders as
{{dts|8|15}}

Error in Template:Date table sorting: months must be an integer between 1 and 12

{{dts|8|Novermber|2011}}

Text output:

Error in Template:Date table sorting: 'Novermber' is not a valid month

Text output with debug:

Error in Template:Date table sorting: 'Novermber' is not a valid month

HTML output:

<strong class="error">Error in [[Template:Date table sorting]]: 'Novermber' is not a valid month</strong>

The month is misspelled in the second example. This results in an error, but it is hidden when it runs through {{dts/out}}. ---— Gadget850 (Ed) talk 13:55, 27 April 2012 (UTC)[reply]

I'll see what can be done to check for invalid input. JIMp talk·cont 00:31, 1 May 2012 (UTC)[reply]
I've added error handling with a subtemplate {{dts/invalid input}}. JIMp talk·cont 12:06, 1 May 2012 (UTC)[reply]
Which suppresses the error entirely, even with an invalid date. --68.57.153.79 (talk) 19:07, 1 May 2012 (UTC)[reply]
Yes. I would have expected a visible error message. ---— Gadget850 (Ed) talk 19:31, 1 May 2012 (UTC)[reply]
Yes, a visible error message would be best in the long run; however, we don't yet know how many pages are misusing the template. Before we go putting up error messages I thought it might be best to fix up those pages already using an invalid date. So far what links here has picked up about a couple of dozen articles with invalid dates. JIMp talk·cont 23:13, 1 May 2012 (UTC)[reply]
Pages with #time errors will eventually be placed in Category:Pages with parser function time errors. Before, you could see a page in the category, and if the error was hidden, you could find it in the rendered HTML and match it to the markup. Now you can't do that. For example, Italian record progression 50 metres freestyle is in the links here, but you will have to check every instance of the template for an error. ---— Gadget850 (Ed) talk 23:31, 1 May 2012 (UTC)[reply]
I have cleaned up all the invalid inputs in the main space. There weren't as many as I thought there might have been. The template is now giving a very obvious error message. JIMp talk·cont 11:01, 2 May 2012 (UTC)[reply]
These edits have broken the handling of YYYY-MM-DD and YYYY-M-D dates. Can you people please fix this? -Rrius (talk) 01:52, 6 May 2012 (UTC)[reply]

Broken output

I have noticed a common usage of this template, i.e. {{dts|format=dmy|2007-01-02}}, doesn't seem to work anymore. It used to render "2 January 2007", instead it now outputs "2 2007 2007". Anyone know what happened? Mushroom (Talk) 11:09, 3 May 2012 (UTC)[reply]

I will fix it. JIMp talk·cont 06:01, 6 May 2012 (UTC)[reply]
It was a typo. It's fixed. Sorry about that. JIMp talk·cont 09:47, 6 May 2012 (UTC)[reply]
Thanks! Mushroom (Talk) 10:43, 6 May 2012 (UTC)[reply]

New abbreviation parameter

The template spells the name of the month out in full by default. If a user wanted the month name abbreviated, he/she had two options.

  1. type the abbreviation as parameter 2
  2. type the abbreviation in parameter 1

The second option is overridden if the format parameter is used. I have added a new option in the form of a parameter abbr.

 3. set abbr to on

Note that this third option currently only works where the other two are not possible. JIMp talk·cont 23:27, 6 May 2012 (UTC)[reply]

Examples
  • For dates of the form {{dts|2010|5|7}} use abbr.
    • {{dts|1984|12|9}} → December 9, 1984
    • {{dts|1984|12|9|abbr=on}} → Dec 9, 1984
  • For dates of the form {{dts|2010-05-07}} use abbr.
    • {{dts|1984-12-09}} → December 9, 1984
    • {{dts|1984|12|9|abbr=on}} → Dec 9, 1984
  • For dates of the form {{dts|2010|May|7}} spell out the date in full or abbreviate directly. abbr is ignored.
    • {{dts|1984|December|9}} → December 9, 1984
    • {{dts|1984|December|9|abbr=on}} → Dec 9, 1984
    • {{dts|1984|Dec|9}} → Dec 9, 1984
    • {{dts|1984|Dec|9|abbr=on}} → Dec 9, 1984
  • For dates of the form {{dts|7 May 2010}} it depends on whether the format parameter is used. If the format parameter is used, abbr will work. If the format parameter is not used, abbr is ignored so spell out the date in full or abbreviate directly.
    • {{dts|9 December 1984}} → 9 December 1984
    • {{dts|9 December 1984|abbr=on}} → 9 Dec 1984
    • {{dts|9 Dec 1984}} → 9 Dec 1984
    • {{dts|9 Dec 1984|abbr=on}} → 9 Dec 1984
    • {{dts|9 December 1984|format=dmy}} → 9 December 1984
    • {{dts|9 December 1984|abbr=on|format=dmy}} → 9 Dec 1984
    • {{dts|9 Dec 1984|format=dmy}} → 9 Dec 1984
    • {{dts|9 Dec 1984|abbr=on|format=dmy}} → 9 Dec 1984

JIMp talk·cont 23:58, 6 May 2012 (UTC)[reply]

Repairs?

It's been two months since this template was last edited. But on none of the pages that link to it, dates show up correctly... Will this template be fixed or has it been replaced? DutchHoratius (talk) 22:41, 2 July 2012 (UTC)[reply]

I've just checked the first half dozen pages that transcluded the template. I found two problems neither of which were due to this template (one page used the template where it shouldn't have another didn't use it where it should have). Could you point out the problem page(s)? It's obviously not all of them. JIMp talk·cont 23:29, 2 July 2012 (UTC)[reply]
Hi Jimp! I've found the following pages for you. I don't know if it's the template or just some other error, but on all these pages dates in tables do not show up.

Mergers by Microsoft
Comparison of Web browsers (specifically the release date columns in the release history table)
Condé Nast Publications
List of current United States governors
List of living cardinals

DutchHoratius (talk) 14:56, 4 July 2012 (UTC)[reply]
I've had a quick look at these pages but I can't seem to find missing dates. Some entries have only the month and year but that not a error caused by {{dts}} but rather due to the template's only being given the month & year (perhaps the day was not known). Have you checked the code on the page to make sure there aren't holes in that? Sorry I can't be of much help. JIMp talk·cont 07:58, 6 July 2012 (UTC)[reply]
Here is a piece of the code for List of current United States governors:
|-
|[[Alabama]]
|[[File:Robert Bentley.jpg|100px]]
|{{sortname|Robert|Bentley|Robert J. Bentley}}
|{{Party shading/Republican}}
|[[Republican Party (United States)|Republican]]
|{{dts|2011|1|17}}
|2015
|[[List of Governors of Alabama|List]]
As you can see, the DTS-template looks fine. Still, on the page itself the date does not show up for me.
On List of living cardinals it's the same thing:
{{dts|format=dmy|1935|9|21}}
Looks fine, but does not show any date. Maybe it's a browser issue? If use Firefox 13, but I don't seem to have problems with other templates.
DutchHoratius (talk) 10:13, 6 July 2012 (UTC)[reply]

It could be your browser. The date is showing up for me. JIMp talk·cont 05:16, 14 July 2012 (UTC)[reply]

Additional sorting parameter

Currently, the template allows for sorting by adding hidden text in the format "02012-11-24". Would it be possible to add a parameter that would force a fourth chunk (i.e., "02012-11-24-01")? The purpose would be to force table items with the same date to sort in a particular order. For example, the sortable table at Justice of the Supreme Court of the United Kingdom has six judges all appointed on 1 October 2009. I wanted to force the table to sort them among themselves by the order in which they were appointed to the Supreme Court's predecessor Court. To do so, I used the following code:

<span style="display:none">02009-10-01-01</span>1 October 2009
<span style="display:none">02009-10-01-02</span>1 October 2009

So what I'm asking for is a parameter that would allow me to write {{dts}} to accomplish the same thing. -Rrius (talk) 12:07, 24 November 2012 (UTC)[reply]

"What it solves" section does not fully conform to MOS:DATE

The "What is solves" section avers unequivocally that the "YYYY-MM-DD format...does not conform to the Manual of Style for date display". This is not completely correct. The MOS:DATE section allows that the format is sometimes "useful in long lists and tables for conciseness". The section should make it clear that, at least in the case of lists and tables, the editor has some latitude in the date format to be used. — Preceding unsigned comment added by 108.79.226.129 (talk) 16:32, 15 February 2013 (UTC)[reply]

More than one month

Hello,

what should I change to have two months listed without any errors? Regards.--Tomcat (7) 11:32, 20 February 2013 (UTC)[reply]

Not exactly sure what you mean by "two months listed"? Perhaps you can list some examples. Maybe try {{dts}} for just the first month, then enter the second month in plain text? Also note the {{date sortable}} template tolerates month and year ranges without errors e.g. {{date sortable|May-June 2008}}. However, dts should be upgraded to handle ranges, ideally allowing {{date sortable}} to be merged here. Dl2000 (talk) 15:43, 2 September 2013 (UTC)[reply]

Y10K support?

I noticed from the examples in documentation have years starting with 0, from which I inferred support for display of the year 10,000 and beyound. Is this true? -Mardus (talk) 02:11, 27 October 2013 (UTC)[reply]

German table error

Extremely unfortunate that this feature is totally incompatible with German WP tables that use dts coded with year at the end!

  • "dts|17|10|2002"
Error: 17 10 2002
This is not an acceptable date format. Please check the spelling, check the numbers and/or read the documentation at template 

-71.174.188.43 (talk) 15:47, 17 January 2014 (UTC)[reply]