Template talk:Date table sorting/Archive 1

Expand the features
This template has no error checking for missing params, like day or month, and it should, since date can sort without them. It broke our Help:Sorting section, too! To convert existing tables in the DD-MM-YYYY format to something pretty, and to do it easily, it needs to be able to take the standard DD-MM-YYYY or DD-MM-YY format. In those cases, there would be no need to error check. Maybe it could just check parameter, perhaps, for dashes and then directly print the full string hidden, then wikilinked, and Mediawiki will do the rest. Let me know if that part doesn't make sense. Sorry I can't figure out how to do that myself.—Wikibarista 17:16, 21 March 2007 (UTC)

Being used outside of sorted tables
The acronym is great, but unfortunately, it's being used incorrectly already by people to just put in dates anywhere in an article. We should rename it to "sortdate" to avoid misuse, because the misuse will cause pages to be larger when they're converted to HTML. —Wikibarista 18:02, 21 March 2007 (UTC)

Template talk:Sort
Centralized discussion for all issues surrounding sortkeys for wikitables created here: Template talk:Sort. ~ trialsanderrors 09:02, 5 April 2007 (UTC)

Possible bugs
My Special:Preferences have the date presentation set to "2001-01-15T16:12:34". Yet when template is passed   I get the output of "15 January 2001". Surely I should be seeing the same output as what   would give me, which is "2001-01-15". What's gone wrong? --Oscarthecat 16:46, 10 April 2007 (UTC)


 * I fixed it, it was due to a blank space in the year link: 12 April 2007 gives 12 April 2007 .--Patrick 07:25, 12 April 2007 (UTC)
 * Thanks for the quick response Patrick. Yes, now working great. --Oscarthecat 20:32, 15 April 2007 (UTC)

Great work this weekend! I noted dts doesn't play nice with sortdate in the same table. I might be wrong on that, I'll have to look later. —Wikibarista 00:28, 17 April 2007 (UTC)
 * A-ha, I see it. dts has a leading 0 whereas sortdate does not. —Wikibarista 00:35, 17 April 2007 (UTC)


 * I have added the zero in sortdate.--Patrick 08:54, 3 May 2007 (UTC)

List of Wii games
It seems like this template is breaking the sortable list of wii games, around the game "Wii Play". I have been unable to solve the problem, is any template coder capable of providing advanced help around? --User:Krator (t c) 14:43, 26 April 2007 (UTC)
 * It seems the limit per Template limits is reached on the page. --User:Krator (t c) 15:07, 26 April 2007 (UTC)

Change entry format from MM-DD-YYYY to YYYY-MM-DD
I motion that we change the entry format for this template from MM-DD-YYYY to YYYY-MM-DD. Pretty much all of the templates that require date entry are using YYYY-MM-DD ( Age in days is one I use often), and this should be changed to conform to that. I think that's standard - even the citation templates use that format. Gary King (talk) 02:36, 26 March 2008 (UTC)

Compatibility with WP:DATE
Based on recent changes to date formats (in particular, date autoformatting) in the Manual of Style for dates, I would like to suggest that "link=off" should be the default setting so that dates are not automatically linked when not specifying a parameter (likely to be the most common usage). If editors wish to link dates, they can set "link=on". Truthanado (talk) 00:15, 15 September 2008 (UTC)


 * A lot of people who use this template might then wonder why the links are now off; they might think something is broken, perhaps. Gary King ( talk ) 03:00, 15 September 2008 (UTC)


 * That kind of confusion is already happening with the major change in the way dates are handled now. In the interest of moving forward to a consistent system, maybe that's an acceptable "bump in the road". Truthanado (talk) 11:32, 15 September 2008 (UTC)


 * I don't mind; I created that feature in this template and would like to see the default as unlinked. But of course, I'm always a fan of consensus, too :) Gary King ( talk ) 14:14, 15 September 2008 (UTC)


 * I think if the policy is to have unlinked dates, then the template ought to be made to be consistent with that policy. It is true that some people might think the template is broken, but then that should hopefully lead them to discover the change in policy, which would be a good thing in the long run! Mrh30 (talk) 09:27, 10 October 2008 (UTC)

You can set the default to be 'link=off' because all articles now use it for dts (and for the now deprecated dts2 template). The default will be useful for new uses. Lightmouse (talk) 13:30, 25 October 2008 (UTC)
 * Done Gary King  ( talk ) 19:02, 25 October 2008 (UTC)

Thanks. Lightmouse (talk) 17:37, 26 October 2008 (UTC)

Day and month without year?
I thought I had already asked this question, but apparently not. :) Is it possible to make this template display a date without the year, i.e. just day and month? PC78 (talk) 23:16, 23 October 2008 (UTC)
 * No, not with its current setup. Gary King  ( talk ) 23:20, 23 October 2008 (UTC)
 * What I mean is, is it feasible to make this change to the template? PC78 (talk) 00:42, 24 October 2008 (UTC)
 * This feature was not implemented probably because it wasn't requested that often. It can be done, though. In which article it is needed? Gary King  ( talk ) 04:27, 24 October 2008 (UTC)
 * I've been using it in articles such as List of South Korean films of 2006, where repeating the years seems rather redundant and takes up space. PC78 (talk) 13:39, 25 October 2008 (UTC)
 * Okay done.  will show as ; it will be sorted along with other dates that do have years, and it's year will be considered as whatever the current year is (so in this case, it would be sorted as  ).  Gary King  ( talk ) 21:19, 25 October 2008 (UTC)
 * Many thanks! PC78 (talk) 13:21, 26 October 2008 (UTC)

Approximate dates
Is it possible to use this table with approximate dates? I'm thinking of dates in the format "c.", "before", "after", "16/17 November" etc. The question relates to List of the titled nobility of England and Ireland 1300–1309 which is currently nominated for FL, where it has been suggested that a sortable list be used. I've found this problematic with so many approximate dates. Lampman (talk) 13:24, 21 February 2009 (UTC)
 * That's not possible with the current code. Regarding implementing it, I think it'd be easier to write custom code for the specific article rather than rewriting this template. Just use sort to do what you want; the first parameter is for sorting, the second is for what you actually want to appear. Gary King  ( talk ) 16:24, 21 February 2009 (UTC)

Retrofit talk-page year headers
19-Mar-2009: I have added subheaders above as "Topics from 2007-2008" (etc.) to emphasize the dates of topics in the talk-page. Older topics might still apply, but using the year headers helps to focus on more current issues as well. -Wikid77 (talk) 12:38, 19 March 2009 (UTC)

Template:Dts/ver for invalid dates
19-March-2009: I have created the temporary variation Template:Dts/ver to allow reporting invalid dates. That template could be merged at a later time, after options are fully developed. Naturally, sometimes people are putting day-number for the month, where 21 gives "September" (21-12=9), 23 gives "November" etc. As in other templates, I was expecting an error-page-category, such as "Category:Template dts invalid month pages" which would silently list all pages with invalid month numbers passed to. Another method, coded in Template:Dts/ver, leaves the default behavior unchanged, but allows an optional verify-switch "v=yes" when invoking dts:
 * { {dts/ver|v=yes |2009|78|55}}  <--verify to report 78 & 55.

When a user sets "v=yes" then problems will display on the page:
 * &lt;br> Template:dts - month "78" > 12 in "2009|78|55".
 * &lt;br> Template:dts - day "55" > 31 in "2009|78|55".

That optional reporting allows each user to change pages to globally replace all "dts|" with "dts/ver|v=yes|" if they think those numbers should be reported. Of course, currently, the template handles any numbers for months/days, which some users might have assigned for special codes, such as day "32" sorts to the end of any month, so "v=yes" would be optional to allow day 32 (etc.) if used for special sorting.

See: Template:Dts/ver for more details. -Wikid77 (talk) 12:38, 19 March 2009 (UTC)

69% of omitted or swapped month/day are invalid
19-March-2009: Verifying the month/day can instantly detect problems in about 69% of cases, where month & day were swapped or month "12" was entered as "21". So verifying the date doesn't just find like 10% or 20% of problems, instead, verification finds almost two-thirds (65%) of all invalid, swapped dates. The total is, for days 13-31 being invalid months, and month "12" inverted as invalid "21":
 * (31 - 12 + 1 for "21") / 31 = 20/31 ~= 64.52%.

Since November's month number 11 doesn't reverse, it is not a problem like December ("12" as "21"). However, if month or day are omitted, they are detected as "0" so that puts the chances of detecting an invalid date even higher than 65%, closer to 69%. Hence, computer-verified dates are a major advantage, in nearly 69% of those common data-entry errors. -Wikid77 (talk) 13:14, 19 March 2009 (UTC)

Nowrap
What about nowrap functionality? It is particularly useful for dates, which tend to get broken into two lines. Of course, one could say: 2009-1-1 but wouldn't 2009-1-1 be better? GregorB (talk) 19:29, 15 April 2009 (UTC)


 * The template can be forced to nowrap by default if people think that makes more sense. There might be some fringe cases where that is unhelpful, though, like in a table where the columns are very narrow. Gary King  ( talk ) 02:46, 16 April 2009 (UTC)


 * Nowrap may well be the default but - as you've noted - this could cause problems (but to what extent, it's hard to say). What I had in mind is to add the nowrap option, but make it default to "off" so as to be on the safe side by not changing the behavior of existing transclusions. This could be the initial setup, at any rate. GregorB (talk) 06:52, 16 April 2009 (UTC)
 * I tried to find an existing table that could cause problems with dts nowrap, but I could not find any. On the other hand, I found many that would benefit from nowrap. So yes, I'd say nowrap=on would really make sense as the default. GregorB (talk) 09:18, 16 April 2009 (UTC)
 * Did it. The new parameter is "nowrap", and it defaults to "on". If there are major problems with this, feel free to revert. Minor problems in individual articles should be fixable by setting nowrap to "off"; I haven't found such cases thus far. I'll update the template documentation shortly. GregorB (talk) 12:05, 27 April 2009 (UTC)

New functionality
I've added the capacity for the template to handle a date as a single parameter. The default formatting is the same (month-day-year) but only applies to ISO input (international format is left as is). It accepts abbreviated month names. It corrects capitilisation and comma mistakes. It uses and so is limited to what the parser function can handle (e.g. it won't go beyond 100 AD). It ignores.

J IM ptalk·cont 00:38, 4 August 2009 (UTC)

New coding
I've also somewhat rewritten the coding for the old functionality. There had been an error whereby  would give a date with month-day-year formatting. In the process of fixing that I changed the code a little. This invloved adding some subtemplates:



The first two are for formatting & the second are for linking/nonlinking. J IM ptalk·cont 00:50, 4 August 2009 (UTC)

Linking
I propose that the linking function
 * 1) not be mentioned on the doc page and
 * 2) eventually be removed.

Date linking is to be discouraged. Having it mentioned here as an option may give editors the impression that it's okay. Is there any conceivable reason to link dates in the sort of tables that this template is designed for?

Once we can be sure that there are no s left we could get rid of the option altogether. How can we be sure? Well, yes, there was something of an alterior motive to my fixing the template up. Here's the list of pages which have. J IM ptalk·cont 01:01, 4 August 2009 (UTC)


 * While I applaud heading in the direction of no linked dates, I plead for a different handling. First, an editor should not have to come here, to the discussion page, to find the meaning of the link parameter -- deprecated or not, it should be on the documentation page.  Second, you don't need to wait until there's no more use of   -- just ignore it in the template code.  Some dates that were linked will then come up not linked, but I'm all for that. The documentation page should then describe   and   as former parameters that have no effect and should be removed when encountered.. . . . Jim . . . . Jameslwoodward (talk • contribs)  12:56, 22 September 2009 (UTC)


 * Okay I readded it. Gary King  ( talk ) 16:35, 22 September 2009 (UTC)


 * So, Jim, you're suggesting the parameter be mentioned so that people can still make sense of transclusions which still use it. Presumably when there are no longer any such transclusions we can forget about it entirely, right. Note that there are no " "s left. It shouldn't be too hard to eliminate any " "s that might exist. Once there are no " "s at all we can safely put the issue to rest since it will only be of historical interest for which mention in talk archives is sufficient. I've changed the doc to better reflect the fact that this is a former parameter which should no longer be used & removed when found. J IM ptalk·cont 17:45, 22 September 2009 (UTC)


 * That's exactly what I wanted, but I had no idea how far along the elimination of "dts|link=" was. I did a search on "dts|link=off" and found only three hits.  I edited them out and now a search on "dts|link=" (and variants with spaces in them) yields no hits except discussions.  I don't know WP's search function well enough to be sure that's definitive, but it must be a pretty good indicator. So, I withdraw my request for including it in the documentation, except perhaps as a former parameter no longer usable, suggest that you eliminate it from the code, and apologize for jumping into the very end of a long process.. . . . Jim . . . . Jameslwoodward (talk • contribs)  11:19, 23 September 2009 (UTC)

Is this intentional?
For years BC we get a different hidden number depending on whether it's input as a negative year or as a year BC.
 * → "1000"
 * → "1000 BC"

Is there a reason for this?

J IM ptalk·cont 14:08, 4 August 2009 (UTC)

Accessibility problem
This template generates output that causes WP:ACCESSIBILITY problems. For example, " " generates output "July 4 1776" that the Lynx text browser renders as "01776-07-04 July 4, 1776", and I assume that screen readers used by the visually impaired have similar misfires. Is this sort of problem inherent to what dts is trying to do with respect to sortable tables? At any rate, the bug (or accessibility issue) should be documented, no? Eubulides (talk) 07:26, 14 September 2009 (UTC)
 * It's a huge problem with sortable tables in general. We can do better than the current implementation (i.e., not using display:none), but it would be a large undertaking. — RockMFR 22:55, 25 September 2009 (UTC)
 * Ooo, ooo! You've got me on the edge of my seat with that tantalizing hint! Please tell us more! How can we do better? Eubulides (talk) 23:20, 25 September 2009 (UTC)
 * We can create a custom sort key attribute for rows, then use that to enter sort keys rather than hiding them in CSS. We're already manipulating tables with JavaScript to sort, so this shouldn't be much more work. Gary King  ( talk ) 00:40, 26 September 2009 (UTC)
 * That's much better, thanks. And it doesn't sound like a "large undertaking", except for the conversion of existing pages (which would not have to be done all at once, of course; we could keep the old, buggy templates around for a while). Eubulides (talk) 01:30, 26 September 2009 (UTC)
 * Yeah, that's pretty much what I was thinking. So if we wanted to go the attribute route, we would have to:
 * Decide on an attribute name
 * Add support for this attribute in MediaWiki (only certain attributes are allowed - the rest are stripped out)
 * Add support for this attribute in the table sorting javascript code
 * Convert existing pages to use new attribute instead of display:none — RockMFR 15:46, 26 September 2009 (UTC)

Add support for "12 Sept. 1928" and "12 Sep 1928" output.
Tables are often places where place is limited. Currently it always outputs the full month. There should be an option to have it output three letter months (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) or AP style months (Jan., Feb., March, April, May, June, July, Aug., Sept., Oct., Nov., Dec.). Headbomb {{{sup|ταλκ}}κοντριβς – WP Physics} 23:45, 23 September 2009 (UTC)


 * Three-letter dates are supported, e.g. → "31 Dec 2000". J IM ptalk·cont 13:57, 24 September 2009 (UTC)
 * Yes, but these involve lots of behind the scenes shenanigans and cannot be deployed in tables more than ~400 times per article before hitting a technical limit. What I have in mind is something more like


 * Headbomb {{{sup|ταλκ}}κοντριβς – WP Physics} 15:11, 24 September 2009 (UTC)


 * It looks fine to me. I ran Jim's version a thousand times and it still works. Gary King  ( talk ) 18:22, 24 September 2009 (UTC)
 * See


 * Is that a mistake? You've got  giving ymd. Has it yet been settled that we'll be using AP in tables (or at all)? J IM ptalk·cont 19:44, 24 September 2009 (UTC)
 * No, he just hardcoded the text, that's why it's in YMD format; check the source code of his post. Gary King  ( talk ) 19:48, 24 September 2009 (UTC)
 * Yeah but it seems to imply that this'll be the output when you use  when it should be "31 Sep 2000". J IM ptalk·cont 20:57, 24 September 2009 (UTC)
 * Mistake from my part, I've fixed it now. Headbomb {{{sup|ταλκ}}κοντριβς – WP Physics} 21:06, 24 September 2009 (UTC)


 * I agree with Headbomb that this should be implemented, and through a switch in a parameter so that an existing table can be modified by simply adding the parameter to each entry. Jimp's kludge is a whole lot of unnecessary work if you have made a table one way, or some other editor has done so, and you decide to change it to abbreviate the months. Or to convert Jimp's format to spelled out months, for that matter. Gene Nygaard (talk) 22:33, 11 February 2010 (UTC)

Sort bug help
List of Kansas City Royals managers has a sort bug in the last column, labeled "WS". Can anybody figure it out? I know that this doesn't strictly concern dts, but this talk page is frequented by more editors so I thought I might as well give it a shot. Dabomb87 (talk) 00:06, 29 September 2009 (UTC)
 * There's probably something wrong with the JavaScript function used to sort tables, because if you change the  in the bottom row to "2", then add another column in that row, then WS sorts fine. So it appears to be a bug in the sorting function.  Gary King  ( talk ) 00:39, 29 September 2009 (UTC)
 * Thanks, I have worked around that bug now. Dabomb87 (talk) 00:45, 29 September 2009 (UTC)

Template protected
I was surprised to see this template was unprotected, since this is being used in a lot of pages. Is there a particular reason this is not protected? I've just semi protected it indefinitely, but maybe it should be given full protection. ≈ Chamal talk ¤ 11:06, 24 October 2009 (UTC)

Template not working in certain pages
The template is not showing up in the List of WWE Tag Team Champions (under the date column) for me (and I asked on IRC, and it's not showing for other users as well and I tried both IE and Firefox). I checked the history, and I couldn't find a time when it did work, so it must be something in the template. What makes this weird is that it works perfectly on this page: List of World Tag Team Champions (WWE). Does anyone have any ideas as to what is going on? -- Scorpion 0422  20:23, 23 December 2009 (UTC)
 * The same issue came up on Avatar (2009 film). I just switched it to Start date. BOVINEBOY 2008 ) 20:55, 23 December 2009 (UTC)
 * Gary King ( talk ) 19:11, 27 December 2009 (UTC)

simpler way?
Wouldn't this accomplish the same thing?

~ 10nitro (talk) 20:15, 3 January 2010 (UTC)
 * Yeah, with a little tweaking it can be done. Gary King  ( talk ) 05:23, 4 January 2010 (UTC)

Difference?
What is the difference between this template and Start date? Erik (talk) 22:33, 10 March 2010 (UTC)
 * This template is used to enter dates into tables so that they are sortable. Gary King  ( talk ) 22:36, 10 March 2010 (UTC)
 * 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)
 * start date, not this one. Gary King  ( talk ) 22:46, 10 March 2010 (UTC)
 * Thanks. I didn't want to continue without knowing for sure.  Happy editing! Erik (talk) 22:52, 10 March 2010 (UTC)

#time limit
This isn't a problem with, but it may be interesting to other users of  :  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 mm dd yyyy format instead of yyyy-mm-dd format. Johnson487682 (talk) 14:36, 15 June 2010 (UTC)

Template output?
According to dts documentation, 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)
 * Fixed. J IM ptalk·cont 10:35, 9 January 2011 (UTC)

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)
 * It can do October 2005. J IM ptalk·cont 10:38, 9 January 2011 (UTC)
 * When I enter a code  it doesn't format the output properly. Can you update "format" values to display onyl the year-value ? -Paul
 * (output: 1992) will do what you want, to display only the year. Gary King  ( talk  ·  scripts )  19:05, 25 February 2011 (UTC)

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)
 * 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)
 * Thanks for the reply. I went with dtsh and typing the interval after it (without template). bamse (talk) 08:14, 27 February 2011 (UTC)
 * I suppose that "dtsh" and "dts" add the same kind of hidden sort code, correct? bamse (talk) 08:15, 27 February 2011 (UTC)
 * Yep Gary King  ( talk  ·  scripts )  19:15, 27 February 2011 (UTC)

Conflict with Skype
Please see Village pump (technical). Thanks, Rambo's Revenge (talk)  12:10, 27 May 2011 (UTC)

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 &#124;  Mclay1  02:28, 28 June 2011 (UTC)
 * Template default is MDY. There is an option to change it to DMY. Gary King  ( talk  ·  scripts )  02:41, 28 June 2011 (UTC)


 * Hence my first question.  McLerristarr &#124;  Mclay1  02:49, 28 June 2011 (UTC)


 * 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)

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)
 * 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. —Th e DJ (talk • contribs) 09:54, 14 July 2011 (UTC)

Hidden year
Is it possible to create and add a new format with hidden year? For example:
 * Input:
 * Output:
 * 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 templates without year such as:. However it produces  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)


 * This is now working.
 * Note that the date is written as one parameter in normal format. J IM ptalk·cont 23:40, 23 April 2012 (UTC)
 * This is now working too.
 * J IM ptalk·cont 09:05, 24 April 2012 (UTC)
 * J IM ptalk·cont 09:05, 24 April 2012 (UTC)
 * J IM ptalk·cont 09:05, 24 April 2012 (UTC)

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  or by a negative year. Worse is the case of using, which is simply ignored.


 * gives -7999-07-01
 * gives -8000-07-01
 * gives 02000-07-01

J IM ptalk·cont 00:28, 25 April 2012 (UTC)


 * 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. J IM ptalk·cont 01:53, 25 April 2012 (UTC)

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. J IM ptalk·cont 05:31, 27 April 2012 (UTC)

Possible bug
This may be of interest. produces "July 9, 0869", with a leading zero as seen here. jonkerz♠ 08:55, 24 August 2011 (UTC)
 * 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)
 * is fixed. J IM ptalk·cont 11:59, 27 April 2012 (UTC)

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.)). J IM ptalk·cont 12:09, 27 April 2012 (UTC)


 * 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 &#124; contribs) 01:25, 28 April 2012 (UTC)
 * 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. Canuck 89 (converse with me) 05:58, 28 April 2012 (UTC)
 * 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. Canuck 89 (have words with me) 06:27, 28 April 2012 (UTC)
 * 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). &mdash; Spaceman  Spiff  07:29, 28 April 2012 (UTC)
 * 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 for example. Bazonka (talk) 07:47, 28 April 2012 (UTC)
 * I would just like to see the month abbreviations set as an optional parameter, as I think the abbreviations look ugly as a default. Canuck 89 (click here!) 09:25, 28 April 2012 (UTC)
 * 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)
 * 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)

Revert until consensus is demonstrated. The Rambling Man (talk) 17:12, 30 April 2012 (UTC)
 * 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. J IM ptalk·cont 23:27, 30 April 2012 (UTC)

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:

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)


 * I'll see what can be done to check for invalid input. J IM ptalk·cont 00:31, 1 May 2012 (UTC)


 * I've added error handling with a subtemplate dts/invalid input. J IM ptalk·cont 12:06, 1 May 2012 (UTC)


 * Which suppresses the error entirely, even with an invalid date. --68.57.153.79 (talk) 19:07, 1 May 2012 (UTC)


 * Yes. I would have expected a visible error message. ---— Gadget850 (Ed)  talk 19:31, 1 May 2012 (UTC)


 * 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. J IM ptalk·cont 23:13, 1 May 2012 (UTC)


 * 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)


 * 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. J IM ptalk·cont 11:01, 2 May 2012 (UTC)
 * 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)

Broken output
I have noticed a common usage of this template, i.e. 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)
 * I will fix it. J IM ptalk·cont 06:01, 6 May 2012 (UTC)
 * It was a typo. It's fixed. Sorry about that. J IM ptalk·cont 09:47, 6 May 2012 (UTC)
 * Thanks! Mushroom (Talk) 10:43, 6 May 2012 (UTC)

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. The second option is overridden if the  parameter is used. I have added a new option in the form of a parameter.
 * 1) type the abbreviation as parameter 2
 * 2) type the abbreviation in parameter 1
 * 3. set  to

Note that this third option currently only works where the other two are not possible. J IM ptalk·cont 23:27, 6 May 2012 (UTC)


 * Examples
 * For dates of the form use.
 * → 1984-12-9
 * → 1984-12-9


 * For dates of the form use.
 * → 1984-12-09
 * → 1984-12-09


 * For dates of the form spell out the date in full or abbreviate directly.   is ignored.
 * → December 9 1984
 * → December 9 1984
 * → Dec 9 1984
 * → Dec 9 1984


 * For dates of the form it depends on whether the   parameter is used.  If the   parameter is used,   will work.  If the   parameter is not used,   is ignored so spell out the date in full or abbreviate directly.
 * → 9 December 1984
 * → 9 December 1984
 * → 9 Dec 1984
 * → 9 Dec 1984
 * → 9 December 1984
 * → 9 December 1984
 * → 9 Dec 1984
 * → 9 Dec 1984

J IM ptalk·cont 23:58, 6 May 2012 (UTC)

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)
 * 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. J IM ptalk·cont 23:29, 2 July 2012 (UTC)
 * 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)


 * 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  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. J IM ptalk·cont 07:58, 6 July 2012 (UTC)


 * Here is a piece of the code for List of current United States governors:
 * |Alabama
 * |Robert Bentley.jpg
 * |Robert Bentley
 * |Republican
 * |2011-1-17
 * |2015
 * |List
 * |2015
 * |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:


 * 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)

It could be your browser. The date is showing up for me. J IM ptalk·cont 05:16, 14 July 2012 (UTC)

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)

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)

"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)
 * If you use YYYY-MM-DD, the date is sortable anyway. Jimp 08:30, 24 March 2014 (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! 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)
 * "dts|17|10|2002"

Please improve this dts code so that source fields with values 1xxx or 2xxx are auto-recognized as YEAR regardless of whether the field is first or last.-71.174.188.43 (talk) 22:48, 17 January 2014 (UTC)

The problem with that would be that some might think that were for November 10 rather than 11 October. Jimp 09:30, 26 March 2014 (UTC)

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)


 * 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. 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)


 * is gone, it has been merged. It never did handle ranges, it simply returned anything that the software didn't recognise as is. It would, of course, be good to allow ranges here but in the mean time it's probably best to use sort. Jimp 16:53, 26 March 2014 (UTC)

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, 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 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.  X  eworlebi (talk) 01:29, 30 July 2011 (UTC)
 * might work (the template adds a zero). Jimp 16:57, 26 March 2014 (UTC)

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: So what I'm asking for is a parameter that would allow me to write 1 October 2009 to accomplish the same thing. -Rrius (talk) 12:07, 24 November 2012 (UTC)
 * I've added a new parameter,, for this purpose. Jimp 09:32, 27 March 2014 (UTC)

Hidden output
The option to hide the output, i.e. create the sort key only, has been added. To do this use. Jimp 09:47, 27 March 2014 (UTC)
 * Why? When would we use this? Andy Mabbett ( Pigsonthewing ); Talk to Andy; Andy's edits 11:21, 27 March 2014 (UTC)
 * It could be used, for example, if the date is given as "ca. 200 BC", "November 25 and 29, 1941" or "present", if the date is something the template can't handle (ranges, for example are currently unsupported) or if some other calendar is being used (e.g. Arabic dates, tables with a mix of Julian and Gregorian dates, lunar calandar dates). Jimp 10:46, 31 March 2014 (UTC)

Reverse Date Sorting
Is there any way to use dts to sort most recent to least recent by default? — Preceding unsigned comment added by Jeremyfrankly (talk • contribs) 16:43, 17 June 2014 (UTC)
 * Dts doesn't do that. It just emits the dates in a sortable way. When you set up the sorting, you need to specify that there. Jackmcbarn (talk) 16:52, 17 June 2014 (UTC)

Why not use tag? It seems like it's designed specifically for this sort of usage. -- Andrew Shadura (talk) 14:11, 31 July 2014 (UTC)

Using this in my wiki?
Hi there, maybe a silly question - but how do I use this in my wiki? Do I need to copy the code of the Template:Dts and all subtemplates for this to work? Is there an easier way than viewing the source code for each subtemplate and coping it?

Thanks Anna Annaisakiwi (talk) 03:17, 2 October 2014 (UTC)
 * This template is a complete mess right now. We're working on a self-contained clean replacement at Module:Sandbox/Dts. You might want to try getting that to work rather than importing all of the subtemplates of this one, which indeed is what you'd have to do. Jackmcbarn (talk) 14:58, 2 October 2014 (UTC)

Alignment
Is it possible to align date(s) to the centre of a table? — TPX 21:49, 18 March 2015 (UTC)
 * If you mean center in a cell, then:
 * --  Gadget850talk 23:13, 18 March 2015 (UTC)
 * --  Gadget850talk 23:13, 18 March 2015 (UTC)

Replacing Dtsh?
I used the DTSH template on tables of fraternity installation dates in sortable tables when the only information available was season, so if I had three fraternity installations as February 1, 1940, Spring 1940 and May 13, 1940, I'd do them as 1940-2-1, Spring 1940, and 1940-5-13 how can I do this without dtsh?Naraht (talk) 00:47, 23 February 2015 (UTC)
 * It's been replaced by hidden. Jimp 11:56, 19 March 2015 (UTC)

Sorting with range of dates
Is it possible somehow to sort with a date range? For example, I have a list of events with the following dates "June 22 - July 3, 1956", "September 20 - October 5, 1946" and "August 1-20, 1934". --Gonnym (talk) 12:53, 14 June 2015 (UTC)
 * There is a manual workaround. Enter the first date of the range in the template, use hide, and then display the date range manually. You may also want to prevent your dates from wrapping by using nowrap. For example,  will give you "1956-6-22June 22 - July 3, 1956". — Mr. Stradivarius  ♪ talk ♪ 04:23, 4 July 2015 (UTC)
 * A very much belated thank you for your assistance Mr. Stradivarius. --Gonnym (talk) 17:31, 10 August 2015 (UTC)
 * Thank's a lot for this. My workaround was to use the generated sort key like  which wasn't pretty or scalable at all. Opencooper (talk) 17:42, 1 October 2015 (UTC)

Available formats
This may not be especially relevant, since automatic support of dates in table sorts has made this template a lot less necessary, but note that at Template:Dts/doc, the list of format options is incomplete—the template also supports MDY to display dates in the format. —Salton Finneger (talk) 14:11, 1 July 2016 (UTC)
 * I'm not quite sure what you mean - mdy is one of the options listed at Template:Dts/doc, but it results in something like, not . Could you clarify? Best — Mr. Stradivarius  ♪ talk ♪ 13:08, 5 July 2016 (UTC)
 * Sorry for not being more clear. I'm not referring to the output formats, but rather the acceptable input formats. I'm looking at the second column of the table at template:dts/doc, where there is a bulleted list showing the date formats that are accepted for input. —Salton Finneger (talk) 17:41, 5 July 2016 (UTC)
 * Ah, I see. That will actually be interpreted as DMY, not MDY. You can check that by going to Special:ExpandTemplates and entering  - it will give you  . — Mr. Stradivarius  ♪ talk ♪ 23:27, 5 July 2016 (UTC)
 * I'd say it's best not to mention this in the doc though. XX/XX/XXXX format is ambiguous. Even though it'd only be in the source code, it'd be better not to encourage it.  Jimp 02:02, 6 July 2016 (UTC)

Support sorting quarters
Would it be feasible without too much hassle to support quarter notation such as "Q1, 2017"? They should be sorted right after the last month of the quarter, e.g. after March 2017 for Q1, after June for Q2, etc. Also the notation for half-years "H1, 2017" is sometimes useful for government documents or future planned events with only a vague announced time range. — JFG talk 18:40, 5 November 2016 (UTC)
 * I'm in support of this idea. The new game list articles frequently come with quarter dates. Template:DTBA was created to support and sort quarters but it would be better it was merged into this template. Rukario -sama   ^ㅈ^ -(...)  21:45, 29 January 2017 (UTC)

Adding wikiLinks?
This template needs to implement wiki links. like 2005 which shows 2005 (not 2005). -- Leyth (talk) 20:16, 28 June 2017 (UTC)

Smarter nowrap=off / wrap=year
A date like 2017-08-28 in one line is really long and widens your date column /whole table quite much and unnecessarily. Fortunately there is the  option, which however doesn't deliver nice data since then it breaks after every date part, e.g. August 28, 2017 ... not really useful either. So I was wondering to have this option smarter in more refined way, so that it would only wrap the year? Maybe with a specific option like ? Thanks! Wikiinger (talk) 19:47, 16 August 2017 (UTC)

Question
Hi! In Alfred Auguste Nemours, dts is used but it prints '1926 – 1930' and this is not a correct date range format as per WP:DATERANGE, we need to remove the spaces and make it '1926–1930', how can I do that? Thanks. --ExperiencedArticleFixer (talk) 05:42, 22 January 2018 (UTC)
 * I think this has been resolved? As explained in an edit summary, dts is for use in sortable tables. Johnuniq (talk) 06:17, 22 January 2018 (UTC)
 * Yes, thanks a lot! --ExperiencedArticleFixer (talk) 16:34, 22 January 2018 (UTC)

Changed the date format in the first point of the What it solves section
First example for the raison-d'être was: "1/8/2013 sorts alphanumerically before 5/3/1967, because 1 is less than 5;" This ambiguous format (m/d/yyyy? d/m/yyyy?) already must not be used on WP, which made for an invalid argument.

1 August 2013 sorts alphanumerically before 5 March 1967, because 1 is less than 5; --Mathieu ottawa (talk) 16:59, 18 February 2018 (UTC)

Adding Display
I *think* that what needs to be added to the code is the following. After line 408 in Module:Dts where is says

if self.format == 'hide' then return '' end I think adding an if self.display then return self.display end Not sure if the self.display test should simply be for existance or if it needs a <> ''. Don't know the language well enough (but I program for a living)Naraht (talk) 17:11, 19 February 2018 (UTC)
 * Module:Dts was last edited in July 2015. Mr. Stradivarius has put proposed changes in Module:Dts/sandbox which can be tested using dts/sandbox.


 * Johnuniq (talk) 23:42, 19 February 2018 (UTC)

Module:Date
@Mr. Stradivarius: FYI, I have been slowly developing some age/date modules which work from 9999 BCE to 9999 CE. For example, extract can handle the current proposal above over that more limited range of years. It accepts dates in a variety of formats so  and   would work as well. I think you should make your change to dts and that it should continue to be used. I am mentioning the alternative only to make you aware that I hope to replace many of the age and date templates which have minor quirks and inconsistencies. I don't think there would be any benefit from replacing dts which is useful for its ability to handle very large years.

Module:Age and Module:Date do the work. The latter can produce a sort key based on the Julian day which allows accurate sorting of dates and times. The sort key increments by 1 for each day, and by fractional amounts if a time-of-day is specified, for example 6:00 am gives 0.25. It works from 9999 BCE to 9999 CE (dates before Julian day number 0 are regarded as negative and sort correctly). Johnuniq (talk) 00:24, 20 February 2018 (UTC)