Jump to content

Template talk:Date table sorting/Archive 2

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by BD2412 (talk | contribs) at 04:07, 24 June 2019 (BD2412 moved page Template talk:Date table sorting/Archive 2 to Template talk:Dts/Archive 2 over redirect: move back until methodology can be sorted out). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Archive 1Archive 2

Compatibility with Manual of Style

Wikipedia:Manual of Style/Dates and numbers#Other date ranges MOS:DOB informs that simple day–day ranges which use an unspaced en dash are perfectly acceptable (sample):

  • 5–7 January 1979; January 5–7, 1979; elections were held March 5–8

Help:Sorting#Day and month gives examples of Dts templates working just fine for one day of the month.

Date
(Day and month)
4 Jan
28 Aug
3 Jan
29 Aug
14 Dec
1 Jan
Date
(Month and day)
January 4
August 28
January 3
August 29
December 14
January 1

However, the ranges (which are recommended by MOS:DOB as perfectly fine), are being rejected by the Dts template en masse. Please fix this if you know how, in order to make the Dts template compatible with our Manual of Style. Thank you. Poeticbent talk 15:02, 16 February 2018 (UTC)

Date
(Day and month)
Error in Template:Date table sorting: '4–5 Jan' is an invalid date
Error in Template:Date table sorting: '28–29 Aug' is an invalid date
Error in Template:Date table sorting: '3–4 Jan' is an invalid date
Error in Template:Date table sorting: '29–30 Aug' is an invalid date
Error in Template:Date table sorting: '14–15 Dec' is an invalid date
Error in Template:Date table sorting: '1–2 Jan' is an invalid date
Date
(Month and day)
Error in Template:Date table sorting: 'January 4–5' is an invalid date
Error in Template:Date table sorting: 'August 28–29' is an invalid date
Error in Template:Date table sorting: 'January 3–4' is an invalid date
Error in Template:Date table sorting: 'August 29–30' is an invalid date
Error in Template:Date table sorting: 'December 14–15' is an invalid date
Error in Template:Date table sorting: 'January 1–2' is an invalid date

It says that they are acceptable for use in articles, but DTS isn't capable of using them in sorts. It would make the logic of figuring out the year, month and day for the purposes of generating a sort string much more difficult. Basically what dts does is takes a variety of formats and figure out the year, month and day from them and uses that to build a long invisible number which allows for consistent sorting. So for example, you can have "2002-02-27" and "26 Jun 1988" in the same list and it will make it so that the second will properly sort before the first. Template:Dts/doc shows all the formats that it does handle. The additional logic to properly handle "January 4-5, 1998", "January 4-February 1, 1998", "4-12 January 1998" "4 January - 1 February 1998" (all of which should sort to the same value" and others would be a significant expansion of the code. Given its use in over 20,000 pages, I think it would take a *lot* of testing as well before release.Naraht (talk) 19:31, 16 February 2018 (UTC)

Additionally, the question become whether every other form should be handled by DTS including circa, after and before...Naraht (talk) 19:33, 16 February 2018 (UTC)

  • Thanks for letting me know about the the DTS handling capabilities, Naraht. Needless to say, the difficulties which you described above do not change the fact that the DTS template – as it stands – is not compatible with the MOS:DOB policy, and the policy does not even inform about that incompatibility, making people like me wonder whether the fault in formatting was ours alone, and thus only wasting time trying to correct ourselves, before giving up on it. Poeticbent talk 20:20, 16 February 2018 (UTC)

{{dts}} works with a single date. Why would you expect it to handle a range of dates? If there are several articles that need such a feature it might be reasonable to make a new template for that specific purpose. I like simple names and Template:dts2 might be good. I see that page was deleted per TfD. It would not be straightforward because the examples here are like "January 4–5" but could be much trickier, such as "1 Feb 2011 to 5 March 2015". Johnuniq (talk) 23:01, 16 February 2018 (UTC)

The "code" for dts is at Module:Dts. If anyone has suggestions on upgrading it to handle date ranges, so that it sorts on the first day in the range, I'd love to take a look. It appears that the primary editor (though no edits since 2015) for the template is Mr. Stradivarius, but as I indicated, the testing would be significant.Naraht (talk) 01:01, 17 February 2018 (UTC)
Please start by linking to a couple of articles where this would be useful. Then produce a comprehensive set of examples that should work. Above we see "4–5 Jan" and "January 4–5". Should hyphens instead of en dashes be accepted? What about "to"? What other forms of input should be accepted? There is no need for an elaborate table—just a simple list showing the date range only. Johnuniq (talk) 08:04, 17 February 2018 (UTC)
If you want an example, the one specific article which prompted me to come here was the Anti-communist_resistance_in_Poland_(1944–1946)#List_of_attacks_on_Communist_prisons,_camps_and_state_security_offices. My intention was to make the sortable-table column about the months of the attacks produce a sensible result: January, February, March ... down to the New Years Eve of the last day of December. Thanks, Poeticbent talk 14:55, 18 February 2018 (UTC)
Hi all. The traditional way to make this kind of thing work is to use {{dts|1945|11|22|hide=yes}}November 22–23 {{dts|1945|11|22|format=hide}}November 22–23. The template part of that produces the hidden sort code only, which makes it sort correctly, and then the only part you see is the text outside of the template invocation.

While this words, it is a little inelegant. I was thinking that it might be neater to change the module to allow a |display= parameter, so that you could do something like {{dts|1945|11|22|display=November 22–23}} instead. Does that sound like a reasonable suggestion? — Mr. Stradivarius ♪ talk ♪ 11:05, 19 February 2018 (UTC)

I think that the original discussion got off track with how to interpret complex examples, and I think that simply having it not do so is probably the right answer. I've used the hidden trick myself for including things like Fall and Spring in fraternity founding listings. I support the addition of a display parameter with the idea that whatever is in display is the entire display. (Having said that, I think the example article should be changed so that the year is part of the same column). I think that the hide parameter should be kept, simply because trying to change everything that uses hide to instead use display seems like a monster task even for a bot, but I think that can be kicked down the road slightly. — Preceding unsigned comment added by Naraht (talkcontribs) 14:39, 19 February 2018 (UTC)
I definitely support change of the module to allow a |display= parameter. The example of "{{dts|1945|11|22|hide=yes}}November 22–23" looks like someone is just trying too hard to do, what's impossible. The actual year column has nothing to do with it. Please, do it, if you know how. Thanks, Poeticbent talk 15:07, 19 February 2018 (UTC)
Oops, I just realised that the current parameter is |format=hide, not |hide=yes. I've fixed my example above. — Mr. Stradivarius ♪ talk ♪ 16:19, 19 February 2018 (UTC)
Poeticbent Since the dates in question for that article range over 1944, 1945 and 1946, once a clear way to change the Month/day column is worked out, I think it does make sense to combine (especially since a sort which simply sorts by year will not be useful), but I'll start that discussion on the article talk page *after* the display parameter is available. — Preceding unsigned comment added by Naraht (talkcontribs) 17:01, 19 February 2018 (UTC)
Makes sense to me. Poeticbent talk 17:44, 19 February 2018 (UTC)
@Poeticbent and Naraht: I've added the |display= parameter to the module sandbox. If you want to test it out, you can do so with {{dts/sandbox}}. Let me know if you spot anything strange. Best — Mr. Stradivarius ♪ talk ♪ 17:08, 19 February 2018 (UTC)
Please try again. We are almost there. {{dts|1945|05|27|display=May 27–28}} does not stop at the month and just one single day in display, but also, automatically adds the year to it, which looks like this: May 27, 1945 (no range given). Also, could you add |hide=yes as a valid alternative to |format=hide. Thanks, Poeticbent talk 17:35, 19 February 2018 (UTC)
@Poeticbent: The main template isn't updated yet, just the sandbox, so for now you need to use {{dts/sandbox|1945|05|27|display=May 27–28}}. As for |hide=yes, I'm not so sure - I think it complicates the code for no real benefit. — Mr. Stradivarius ♪ talk ♪ 22:55, 19 February 2018 (UTC)
@Mr. Stradivarius: Any chance this template will get updated with the |display= functionality? - PaulT+/C 17:20, 30 March 2018 (UTC)

Documentation

Looking at Template:Dts/doc there are tables which all have empty "hidden sort key" columns. So then why is that column there? Is it for addkey or is it for the value of span attribute data-sort-value as seen here: view-source:https://en.wikipedia.org/w/index.php?title=User:User123o987name/sandbox&oldid=876188630? I think it's for the former, but if it is for the latter then values will be difficult to add considering how convoluted things are. --User123o987name (talk) 19:09, 31 December 2018 (UTC)

Day of the week

Is there an easy way to get output to automatically determined and include the day of the week? NewsAndEventsGuy (talk) 15:28, 16 March 2019 (UTC)

See {{WEEKDAYNAME}} and {{Weekday}}. {{WEEKDAYNAME|{{Weekday|2001|09|11}}}} → Tuesday. There might be an easier way. – Jonesey95 (talk) 18:16, 16 March 2019 (UTC)
Thanks. I should have been more clear. I would like to input 3-16-2019 into a single template to produce Sat., 16 Mar 2019 or the equivalent. NewsAndEventsGuy (talk) 18:54, 16 March 2019 (UTC)
There may be a way to decode 3-16-2019 using this template but I hope not because that format is ambiguous (although the values make it obvious in this case that it is month-day-year). Something like 4-1-2019 could be April 1 or 4 January 2019. Using {{extract}} it is possible to decode unambiguous dates:
  • {{extract|2019-3-16|show=%a., %-d %b %Y}} → Sat., 16 Mar 2019
  • {{extract|Mar 16, 2019|show=%a., %-d %b %Y}} → Sat., 16 Mar 2019
The date codes are documented at Module:Date. Johnuniq (talk) 23:04, 16 March 2019 (UTC)
Thanks and I apologize for still not being clear. If I type 3|16|2019 in any order..... Or if I type those numeric digits with some other dilineation...... is there a single SIMPLE template that will output a date in any format that includes the day of the week?NewsAndEventsGuy (talk) 00:12, 17 March 2019 (UTC)
As well as {{extract}}, you could also try using the #time parser function, although I wouldn't call it simple. Maybe taking a different tack would be best here - where are you thinking of using this date-converting function? If we know a little bit more about what you want to use it for we might be able to give you some better options. Best — Mr. Stradivarius ♪ talk ♪ 09:45, 17 March 2019 (UTC)
Thanks to all for help here. Whether it is needed is a matter of ongoing discussion at School strike for climate. My personal opinion remains conflicted.
This paragraph is an offtopic sidebar that I offer just to briefly explain the substance of the dispute, to give context. No need to reply to any of this here, though if you have thoughts to share it would be great to read those in the thread at talk page for the article. The location is School strike for climate. In defining the article scope the lead specifically says the events involve kids skipping school to protest for climate action. The key things is "skipping school". On article talk an IP observed that some of the events may have been held after school hours or on days when school was not in session. So the question is whether such individual events qualify for inclusion in the table. If this tool existed, it could help assess the scope of this dilemma. I could copy paste the entire table to a word processor and reformat the data in the date date column with a search and replace macro then copy back to the article. What we DO with the result is a matter for continued editing/discussion.
Returning now to topical question about the tools, in order to be really useful it would have to be super simple for a wide range of international nonNative English speakers to use. Thanks to all for your help. Again, if you have comments on the substance of the dilemma please add them at article talk. And thanks!
NewsAndEventsGuy (talk) 14:07, 17 March 2019 (UTC)

Can the subpages be deleted now that a module is being used?

It appears that most or all of the subpages of this template are no longer used, now that it has been converted to a module. Here's a list of the subpages:

Can we nominate these subpages for deletion? Is there any reason to preserve them for historical reference? I'll check each one for incoming links and transclusions before nominating, unless someone here wants to take on the TFD work. – Jonesey95 (talk) 20:33, 26 February 2019 (UTC)

The more urgent problem is that this template is being used in many places where it isn't necessary. {{3x|p}}ery (talk) 23:22, 26 February 2019 (UTC)

MM/DD/YYYY?

Has this template rejected attempts to use the MM/DD/YYYY format?, It outputs a format like that in DD/MM/YYYY.


{{dts|08/04/2006}} should be displayed as 4 August 2006, instead it will output 8 April 2006.--98.31.29.4 (talk) 17:22, 28 March 2019 (UTC)

Invalid input template?

{{#time: m/d/Y|{{dts|2006-08-26|format=dmy}}}} should output 08/26/2006 but instead it outputs as Error: Invalid time..

{{date|{{dts|26/08/2006|format=dmy}}|ISO}} should output 2006-08-26 but instead it outputs as 26 August 2006 (not converted to ISO).

Why is this template an invalid input?

The #time parser function and the {{date}} template have valid inputs, if the format input is valid then it should work, but why not this one? --2605:A000:1103:76B:C962:C32:B19B:FE71 (talk) 01:22, 29 April 2019 (UTC)

{{dts}} is for sortable dates in a table. It outputs a hidden sort key which you can see at Special:ExpandTemplates. The sort key means it is cannot be parsed as a date. Johnuniq (talk) 03:35, 29 April 2019 (UTC)