Template talk:Date

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
SpBot archives all sections tagged with {{Section resolved|1=~~~~}} after 5 days. For the archive overview, see Special:PrefixIndex/Template talk:Date/Archive .

Give an option to switch hCalendar off[edit]

Hello, I would like to request to add a parameter like |hCalendar=no, with which it's possible to turn this hCalendar off. There are sometimes circumstances in which this isn't doing anything good (for example when using with Category: formatting). This doesn't mean that it should be switched off be default, no, it's a great thing, just to make it possible. For example, it's planned to turn it off in {{Creator}}, so that it's possible to categorize with the {{{Date}}} parameter. What is your opinion on this? --The Evil IP address (talk) 14:31, 27 September 2009 (UTC)Reply[reply]

Merge with Other date[edit]

I think, this template should be unified and merged with {{Other date}}. --ŠJů (talk) 22:01, 5 December 2009 (UTC)Reply[reply]


Mediawiki now support the time HTML5 tag that is done in order to improve machine readability of dates (spec). It's now the recommended way to add date in microformats. I have modified the sandbox version of the template to add support of <time>. The dates are now outputted using an HTML tree like: <time class="dtstart" datetime="2009-01-09">2012 January 9</time>. I have also added a new parameter to the template, "class" that is done in order to allow to change the class of the time node in templates like {{Creator}}. What do you think about this change? Can an admin merge this change in the template? Tpt (talk) 20:26, 4 December 2012 (UTC) {{Editrequest}}Reply[reply]

This last change is producing undesirable results in other templates that depend upon {{Date}}, as for example {{Monthbyyear}}: {{ucfirst:{{date|2013|6|4=pt}}}} should display "Junho de 2013", but because of the invisible markup tag the ucfirst stopped working and "junho de 2013" is displayed instead. Is this <time> tag really necessary? Capmo (talk) 05:39, 24 May 2013 (UTC)Reply[reply]
Hi. I see the broken behaviour when visiting a page with a {{delete}} tag and using ?uselang=es (or any other language than English). However, we cannot leave this edit request template live forever. If you would like, you can post on COM:VP about this. When making edit requests, please post specific changes (code) you would like. Killiondude (talk) 20:52, 4 July 2013 (UTC)Reply[reply]
The change I request is quite obvious: revert the last edit that introduced microformats and think of another way of doing it! Capmo (talk) 05:19, 5 July 2013 (UTC)Reply[reply]
Hi. Please make a version you wanted be applied on a test page and link that here for admins then put {{Editprotected}} again. Thank you :) −ebraminiotalk 21:31, 6 November 2013 (UTC)Reply[reply]


{{Edit protected}}

Please add a case for Vietnamese (vi) below the existing Thai (th) case:

|vi      ={{#expr:{{{3|}}}}} {{I18n month|{{{2|}}}|{{{4|}}}}} {{#if: {{{1|}} | năm {{{1}}} }}

I've implemented this change at Template:Date/sandbox. Thank you!

 – Minh Nguyễn (talk, contribs) 09:08, 25 April 2014 (UTC)Reply[reply]

✓ DoneFace-smile.svg Thank you. --Jarekt (talk) 12:27, 25 April 2014 (UTC)Reply[reply]


{{Editrequest}} I suggest to put the date in a ‎<span>...‎</span> container with style="white-space:nowrap", because date in a line wrap look always very disturbing. -- Perhelion 21:05, 19 May 2014 (UTC)Reply[reply]

Can you show us examples of dates with and without "wrap" and say why one is better than the other?--Jarekt (talk) 13:40, 27 May 2014 (UTC)Reply[reply]
Everywhere where the date is in continuous text, for example Template:Centralized discussion, Commons:Transition to SVG (in the first box) Ok it is not often, that the date is on a longer continuous line, but I think it can't hurt to look. -- Perhelion 18:10, 27 May 2014 (UTC)Reply[reply]
Please excuse my ignorance, but the purpose of this change is so the date always stay on the same line, right? --Jarekt (talk) 18:33, 27 May 2014 (UTC)Reply[reply]
I'm also a little apologetic of my harsh kind (…). Specifically, it only means that the date will not be parted, it can also slide on a new line. (PS: as you can see in my signature) -- Perhelion 09:02, 28 May 2014 (UTC)Reply[reply]
✓ Done--Jarekt (talk) 11:46, 28 May 2014 (UTC)Reply[reply]

Template rewrite using Lua Module:Date[edit]

After extensive testing I just released a new version of Date template written entirely in Lua and based mostly on {{#time}} parser function, see Module:Date. The aim of the rewrite was to preserve ALL of the Template:date outputs. {{ISOdate}} might follow after more testing. Please alert me if mew version causes any issues. --Jarekt (talk) 18:51, 17 June 2014 (UTC)Reply[reply]

Bug for triple-digit dates[edit]

{{date|642}} => 642

It should read 642, not 0642. Magog the Ogre (talk) (contribs) 01:08, 4 July 2014 (UTC)Reply[reply]

@Jarekt: ping, as this is likely related to your module update. Magog the Ogre (talk) (contribs) 01:09, 4 July 2014 (UTC)Reply[reply]
The old code, when formatting for english, did not zero-pad the year, but it preserved any leading zeros from the year if the user zero-padded the year themselves. The new Lua code always zero-pads to a four-digit year. I'm not sure which is the preferred behavior. With the old code dates with two-year digits could end up looking like "10 May 12", which is very ambiguous (i.e. for that date is the year 10, 12, 2010, or 2012?). Do you think the correct behavior should be to use three digits for years in the range of 100-999, but four digit years for 0-99 (or maybe just years 0-31)? —RP88 (talk) 02:09, 4 July 2014 (UTC)Reply[reply]
I don't think the situation you're mentioning is actually a problem; I'm not sure that any single piece of art prior to 100AD has a known date more specific than the year. And in the rare case that we detect one, I'm thinking it's probably uploader error, and the file should be placed into an incorrect template parameter category. Magog the Ogre (talk) (contribs) 02:33, 4 July 2014 (UTC)Reply[reply]
So your preference would be to never zero-pad the year, or perhaps never zero-pad the year if only a year is supplied (even if the user supplies a zero padded year)? —RP88 (talk) 02:37, 4 July 2014 (UTC)Reply[reply]
(edit conflict) I personally find padded years much less ambiguous, for example "August 0023" is much more clear than "August 23" which can be confused with "23 August". That is why when I noticed that {{#time}} function pads the years I assumed that that is preferred behavior. But I agree with RP88 that years in range 100-999 are not ambiguous (actually 32-999) and much more likely to be used and may be those should be stripped. That might be something to ask about on the VP. --Jarekt (talk) 02:45, 4 July 2014 (UTC)Reply[reply]
By the way removing the padding can be easily done on the final strings by regexp replacement of "0\d\d\d", "00\d\d" and "000\d". That could take care of most languages that use western Arabic numerals. There is probably some clever way to catch all cases for all languages. --Jarekt (talk) 03:06, 4 July 2014 (UTC)Reply[reply]
Let's move this discussion to a larger forum. See Commons:Village_pump#Date_formatting_used_by_.7B.7Btl.7CInformation.7D.7D_and_other_infobox_templates--Jarekt (talk) 14:33, 7 July 2014 (UTC)Reply[reply]

Pictogram voting keep-light-green.svg Fixed I deployed a version of the code where 3 digit years are trimmed but one and two digit years are padded. --Jarekt (talk) 18:22, 14 July 2014 (UTC)Reply[reply]


This template makes nonsense in Quechua: "9 de iniru de 2009" though it should be "9 ñiqin inirupi 2009 watapi" (alternatively, "9 ñiqin iniru killapi 2009 watapi"), as it has been localized on translatewiki.net. How does this happen? It should be fixed ASAP. -- AlimanRuna (talk) 19:25, 17 July 2014 (UTC)Reply[reply]

The date in Quechua should be shown according to https://translatewiki.net/wiki/MediaWiki:Pagetriage-info-timestamp-date-format/qu - d ñiqin MMMM killapi yyyy watapi -- AlimanRuna (talk) 11:43, 18 July 2014 (UTC)Reply[reply]
The original date format "9 de iniru de 2009" was chosen because fallback for Quechua language is Spanish and Spanish uses dates with "de". It makes no sense in this case but using the format of the fallback language often works better than English format. Thank you for informing me about the translatewiki page. I do not know who uses it but it is full of errors and uses some Google encoding not compatible with {{#time:}} parser function encoding. I added Quechua to Module:I18n/date so {{date|2009|01|09|lang=qu}} will show as "9 ñiqin inirupi 2009 watapi". If you want we can try to set up your preferred format "9 ñiqin inirupi 2009 watapi", but you would have to let me know the form for all the months (do you just add "pi" or is it more complicated?). Also you only provided formats for dates in YMD form (year-month-day) so I made educated guesses about several other forms, when day or year is missing, or we just need month or year. Please advice. --Jarekt (talk) 14:19, 18 July 2014 (UTC)Reply[reply]
Thanks for adding Quechua to Module:I18n/date. For the forms of the months, just add "pi" to the month (as you were guessing): "9 ñiqin inirupi 2009 watapi". For "9 January", it should be "9 ñiqin inirupi", for "in January, 2009": "inirupi 2009 watapi", and for "January, 2009": "iniru 2009 watapi", and for "in 2009": "2009 watapi". I am going to add other forms in Template:Other date/sandbox. -- AlimanRuna (talk) 15:32, 18 July 2014 (UTC)Reply[reply]
I changed Module:I18n/date and added the testcases to Module:Date/testcases (see results) and Module:Date/sandbox/testcases (see results). I think everything works except for nom/gen cases which I will need to add to Module:Date/sandbox and then once it works to Module:Date. Please verify the testcases and change/add if necessary. --Jarekt (talk) 16:33, 18 July 2014 (UTC)Reply[reply]
Thanks. I've added the other dates at Template:Other date/sandbox. -- AlimanRuna (talk) 16:52, 18 July 2014 (UTC)Reply[reply]
Unfortunatelly Template:Other date/sandbox was not synchronized with Template:Other date, and I do not have much time to work on this. If you or someone else merg it with current version of Template:Other date I could deploy it otherwise I will have to work on it latter, unless some other admin beets me to it. --Jarekt (talk) 17:24, 18 July 2014 (UTC)Reply[reply]
✓ Done I merged Template:Other date/sandbox and Template:Other date. Thanks. --Jarekt (talk) 13:04, 19 July 2014 (UTC)Reply[reply]
Thanks, it looks fine. -- AlimanRuna (talk) 14:39, 19 July 2014 (UTC)Reply[reply]

Kichwa [qug][edit]

In Kichwa [qug] it is the same as in Quechua [qu], except for "niki" instead of "ñiqin" (and - not needed in these simple cases - "puncha" (day) instead of "p'unchaw"). -- AlimanRuna (talk) 16:15, 18 July 2014 (UTC)Reply[reply]

I will need to add it later but it would be great help if you alter the testcases. Also could you suggest what Kichwa code would look like, maybe:
	['qug-form'] = {
		YMDHMS='j "niki" F"pi" Y "watapi", H:i:s',	
		YMDHM ='j "niki" F"pi" Y "watapi", H:i',	
		YMD   ='j "niki" F"pi" Y "watapi"',	
		YM    ='F"pi" Y "watapi"',		
		MD    ='j "niki" F"pi"',		
		Y     ='Y',
		M     ='F'

I do not understand the "simple cases". --Jarekt (talk) 16:40, 18 July 2014 (UTC)Reply[reply]

I think that's it, thanks. The "simple cases" are those without "from ... until", "after" and so on (i.e. not the "other dates"). -- AlimanRuna (talk) 14:45, 19 July 2014 (UTC)Reply[reply]
If for the purposes of {{Other dates}} you need month names in some different grammatical case. We can set it up. --Jarekt (talk) 19:09, 19 July 2014 (UTC)Reply[reply]

{{date|1944|0|0}} renders to 1944[edit]

Hi there, is this rendering the expected one? I guess no. Could some please help fixing it? I guess the exptected behaviour would be a warning or just the year 1943. --Arnd (talk) 13:15, 21 December 2016 (UTC)Reply[reply]

{{date|06|2010}} renders to 0006 (empty string). Can't we create a maintenance category for such cases? --Arnd (talk) 11:11, 12 March 2018 (UTC)Reply[reply]
Yes, we do not have good error checking in that module. That was mimicking behavior of the previous template. but You are right we can track it. The issue is that if you track something nobody feels like fixing than you just get clutter. Also in most cases people do not call {{Date}} directly but through {{Information}} and {{ISOdate}}. --Jarekt (talk) 02:31, 13 March 2018 (UTC)Reply[reply]
Jarekt, is there a test wiki that has a copy of the Commons content? For me i often just need a list to start working. So we could just add such maintenance categories there but edit the pages on the real one. --Arnd (talk) 14:25, 16 March 2018 (UTC)Reply[reply]
I am unaware of any test wiki. By the way, {{#time: r|1944-00-00}} gives "Tue, 30 Nov 1943 00:00:00 +0000", so the issue is with MediaWiki, but we can still track it. --Jarekt (talk) 14:40, 16 March 2018 (UTC)Reply[reply]
Arnd looking at line 114 of Module:Date it seems like the code checks for values bigger than the maximum (like month = 13) and returns empty string when found. I can add the same if any value is smaller/equal to zero. I am afraid to add tracking category, because that is such a low level function used by so many, that it could have some unforeseen consequences, but returning empty string for {{date|1944|0|0}} would be easy. --Jarekt (talk) 14:52, 16 March 2018 (UTC)Reply[reply]
I addressed the issue in my latest edit: month, day, etc outside allowed range are ignored, but we do try to show the date based on what is left. --Jarekt (talk) 12:34, 12 April 2020 (UTC)Reply[reply]


I just did a rewrite of Module:DateI18n to use Data:DateI18n.tab as main repository of language specific settings. Alert me if there are any issues. --Jarekt (talk) 12:25, 12 April 2020 (UTC)Reply[reply]

Add timezone[edit]

Add timezone, useful for hour and minute parameters. --Robot8A (talk) 16:00, 26 September 2020 (UTC)Reply[reply]

Bug? - Month names out-by-one[edit]

See Template talk:Mannheimmonthyear, Category:September 2014 in Leipzig and others. Andy Dingley (talk) 00:14, 1 February 2021 (UTC)Reply[reply]

How is {{Date|2021|05|15}} better?[edit]

See diff.


It shows up spelled out in English (15 May 2021) when I look at the file page. See this version:

Same as {{Date|2021|05|15}} shows up spelled out in English (15 May 2021) in this version of the file page:

Unless you can tell me why the template is better why are people "correcting" the normal dating method of YYYY-MM-DD. It is adding an additional template burden to the Mediawiki software.

I believe Mediawiki software spells out the date in the language of the editor, according to their preferences. --Timeshifter (talk) 17:07, 25 June 2021 (UTC)Reply[reply]