Template talk:Opdrts

Untitled
My scraping of Opinion polling for the next United Kingdom general election has stopped working because I am failing to strip the white space for the dates when this new template is used. This only happens where the period spans two months. I am getting a character that is not a space (after the first month and before the hyphen). What is it? Can it be a space?Cutler (talk) 17:41, 22 October 2020 (UTC)
 * I think that is what is generated by Spaced en dash, which the doc says is  (without underscores).  I also use nowrap on the 1 or 2 dates which its doc says it generates  . I can easily change away from Spaced en dash into the old spaces if that solves it - I've just done that so you can see if that fixes your problem.  But the nowrap on the dates seems useful, and there seems no easy alternative as the space there is generated by #time so I cannot manually change that to a nbsp.  Let me know if the first change solves your problem.  Though it might be wise for you scraping code to accept a nbsp as a space, as it is the kind of thing that can easily change.  Rwendland (talk) 20:43, 22 October 2020 (UTC)
 * Many, many thanks. That worked. I had a suspicion it was a nbsp. I need to improve my "regular expressions in R" skills to make my code more robust. I will try to work on that so you can revert if that makes sense in some other context in the future.Cutler (talk) 21:26, 22 October 2020 (UTC)
 * Great that works. I'll probably leave it alone as having a nbsp before the dash to force any break later does not seem a big deal.  Rwendland (talk) 00:29, 23 October 2020 (UTC)

MDY Date Format
Hello, first of all, this is a great template and I want to use it for Canadian articles, however, it would be great if there is a parameter specifying the date format (e.g. 1 Jan 2021 and Jan 1, 2021 date formats), since most articles in Canada do use MDY. Thanks. — Eric0892 (talk) 00:33, 27 July 2021 (UTC)
 * Hi. I had wondered about offering a North American date style version, but never got around to it.  Unfortunately its non-Lua code is pretty horrible and took much longer to get right than I expected, and it is not at all easy to make flexible for a multiple output styles unless re-implemented in Lua.  It is my first and only code template!  Would having a variant with a different name be OK, eg opdrts-na, opdrtsna, opdrtsus or something better?  I could then simply clone the code to the new name with simple adjustment of the output styles.  Rwendland (talk) 13:52, 27 July 2021 (UTC)
 * I think that a different name should be fine; If you can't code it yourself, I can do it for you. Thanks — Eric0892 (talk) 01:33, 28 July 2021 (UTC)
 * I'm happy to do it, as I'm familiar now with #time and the horrible code. But the tricky thing is choosing a good name. Another option is opdrtsmd or opmddrts or even opmdrts (Opinion Poll Month-Day Range Table Sorting). Which do you prefer - I don't have a strong opinion, just slightly preferring opmdrts? Rwendland (talk) 14:10, 28 July 2021 (UTC)
 * I’m thinking something like opdrts-md or opdrtsmd, but opmdrts could work as well. — Eric0892 (talk) 15:56, 28 July 2021 (UTC)
 * I've created opmdrts to do it. We can change the name (move template) if you prefer another.  You can see what it does in the Examples given - is this right?  I've not tried it out in any articles, but the Examples use the template so that tests it, add more examples if there are other tests you want to add.
 * I've left the input args in the same order for now: Start Day (optional)|End Day|End Month|End Year|"year" (optional). If you want to change that to a more convenient North American order can you say what you prefer, as the obvious one seems a bit clunky to me: End Month|Start Day (optional)|End Day|End Year|"year" (optional).  I should have used ISO order for opdrts which would be good for all variants, but too late to change now. Rwendland (talk) 15:51, 29 July 2021 (UTC)
 * Alright, thank you very much! — Eric0892 (talk) 00:26, 30 July 2021 (UTC)

Template needs updating for semantics
Using this template in a cell alongside  (e.g. here) creates issues. There needs to be a way to make this template work with template semantics for accessibility. ―Justin ( koavf ) ❤T☮C☺M☯ 16:24, 31 March 2023 (UTC)

Polls lasting over a month
The polling here took place over a period lasting longer than a month. The report says it was conducted between 6 February and 23 March 2023. This means I have had to add the dates without the template, as the template cannot handle timeframes of over a month. I have emailed the Lord Ashcroft Polls website to ask if they can provide the UK dates, should they be different to those used for the polls as a whole. I won't hold my breath for a reply, but I thought I'd mention this here, to see if there's any way to work around such dates being used in a sortable table. Perhaps @Rwendland and @Ralbegen can advise. I've added this poll to Republicanism in the United Kingdom. I assumed that the start date would place it in that order, even though the end date comes after the next poll chronologically. TrottieTrue (talk) 14:50, 3 May 2023 (UTC)
 * If you add a sort value before a pipe | with the display value afterwards, it should work! I've implemented it in the republicanism article and it appears to work? Thank you for keeping it in an opdrts-consistent format though, this template was one of the best innovations in polling articles for a long time. Ralbegen (talk) 20:33, 3 May 2023 (UTC)
 * Thank you for adding the sort value - yes, it does seem to work. I didn't realise I needed to use the opdrts template when I was adding polls, but I understand it now. The only problem is that I can't seem to use that template in the Visual Editor. It's the same for the cells with background colours. I can only add those bits of formatting in Edit Source mode. TrottieTrue (talk) 21:52, 3 May 2023 (UTC)