Template talk:ISOdate

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Info non-talk.svg Template:ISOdate has been protected indefinitely because it is a highly-used or visible template. Use {{Edit request}} on this page to request an edit.
Please test any changes in the template's /sandbox or /testcases subpages, or in a user subpage, and consider discussing changes at the talk page before implementing them.
Filing cabinet icon.svg
SpBot archives all sections tagged with {{Section resolved|1=~~~~}} after 5 days. For the archive overview, see Special:PrefixIndex/Template talk:ISOdate/Archive .

Genetive form[edit]

I detected that {{Information}} which calls this template displays incorrect form of the date. In Belarusian (both be and be-tarask) the month name should be in genetive form, for example: 5 лютага 1999, not 5 люты 1999. In Russian it works fine (shows genetive form). When form month-year is used, default month name should be used: люты 1999. Is it able to be resolved? Wizardist (talk) 18:59, 15 April 2010 (UTC)

The exact formatting of the date is handled by {{Date}}. The Belarusian behaviour is the same as Russian, right? If you can confirm this, I can take the Russian formatting line and insert a corresponding line for Belarusian. --Slomox (talk) 21:29, 15 April 2010 (UTC)
Yes, the same as Russian.. Wizardist (talk) 15:18, 2 June 2010 (UTC)
  • And regarding the instrumental case, in Russian we never use it in "Day MonthIns Year", only in "MonthIns Year". In fact, only "Day MonthGen Year" is allowed when we name the full date. Ain92 (talk) 21:45, 26 December 2014 (UTC)
Please check now. I think I corrected it. See Module:I18n/date. --Jarekt (talk) 22:50, 26 December 2014 (UTC)

Old date entries by CommonsHelper etc.[edit]

Some bot (maybe CommonsHelper?) moving files from Wikipedias filled the date field of {{Information}} template with entries in format "2006-08-06 (original upload date)" (an example here). But the hyphen-format of date is correctly localized only when it isn't followed by next text. As i can see here, it is possible to replace it with {{Original upload date|2006-08-06}}

  • 1) Can somebody transform (through a bot) all actual occurences of "(original upload date)" using the localizing template?
  • 2) Also there is wanted to replace (using a bot) all hyphen-shaped dates combined with posterior text with {{date}} or {{other date}} templates
  • 3) What about to modify the template {{ISOdate}} in such way that the sample {{ISOdate|2010-08-18 arbitrarytexttexttext}} would be represented as "18 August 2010 arbitrarytexttexttext" - this treatment can resolve also many other types of notes and comments added to the date
  • 4) There exist several special templates for distinguish the event which is related to the date or for origin of the date: {{According to EXIF data}}, {{Original upload date}}, {{Taken on}}. Also other similar ones should be created: {{firstly published}}, {{source published on}}, {{retouched on}}, {{panorama created on}} {{files combined on}}), {{created on}}, {{date of first version}}, {{date of last version}}
  • 5) What about to allow a type of event (meaning or source of the date) as a new parameter of {{ISOdate}} {{date}} or {{other date}} templates? Examples:
    {{date|2009|1|9|event=taken}} → taken on 9 January 2009
    {{ISOdate|2010-08-18 08:15|event=firstly published}}
    {{other date|circa|1999-05-01|2000-06-1|event=taken}}
    Typicall values can be also standardized and localized through special templates, other values can be used as a text
  • 6) Also parameter "time" should be added to {{date}} or {{other date}} templates in order to be full-featured equivalents of {{ISOdate}}
  • 7) Would be possible even to unify those templates and transform all {{date}} or {{other date}} to {{ISOdate}}?

--ŠJů (talk) 14:20, 30 November 2010 (UTC)

The "date" parameter should never contain original upload dates. They just don't belong in there. The original upload date should be present in the original upload history, which should be a section of its own below the {{Information}} template. So if we start a bot to touch "original upload date" information, the bot should rather eliminate the original upload dates from the "date" parameter (if it is present in the original upload history) or mark the file for review so a valid original upload history can be added.
What about to modify the template {{ISOdate}} in such way that the sample {{ISOdate|2010-08-18 arbitrarytexttexttext}} would be represented as "18 August 2010 arbitrarytexttexttext": That's technically impossible (at least with non-server-melting technical means).
About creating new date context templates: {{first published}} sounds okay, the date of publication is relevant for license questions, but most of the other templates sound like information mud to me. Of course we could theoretically provide e.g. {{files combined on}} information, but for what reason? Who would need that information? And if somebody needs it: why can't he look up the date in the file history where it should be present? If we have all these dates in the template it will draw away focus from the more relevant information and this disadvantage outweighs all possible benefits I can think of.
The "event" parameter thing sounds interesting. We should spend more thoughts on it and I would like to hear other opinions on it.
Also parameter "time" should be added to {{date}} or {{other date}} templates in order to be full-featured equivalents of {{ISOdate}}: Do you have any example where this would be useful? I guess it would be possible and I don't see any big drawbacks, but I also feel like this is hardly ever relevant.
Would be possible even to unify those templates and transform all {{date}} or {{other date}} to {{ISOdate}}? I guess it would be possible, but for what purpose? I guess the added complexity of a unified template would outweigh any possible benefits. --Slomox (talk) 18:12, 30 November 2010 (UTC)

Nowrap[edit]

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

Can you show us examples of dates with and without "wrap" and say why one is better than the other?--Jarekt (talk) 00:54, 20 May 2014 (UTC)
Partially done. The date part was done in {{date}}. --Jarekt (talk) 11:51, 28 May 2014 (UTC)

Converting to Lua[edit]

So at WikiConference USA this template was brought to my attention as one that would benefit from being converted to Lua. So I took the liberty of doing so. The draft code is at [[Module::ISOdate]], and you can see it in action at User:Parent5446/Sandbox. I'm working on creating documentation and unit tests for it. If there is anything that looks wrong, please edit it or let me know. Parent5446 (talk) 03:32, 2 June 2014 (UTC)

User:Parent5446, thanks a lot - this is a great start. I copied your code to Module:date/sandbox (with other similar function) and started a battery of tests at Module:Date/sandbox/testcases (tests) and Module talk:Date/sandbox/testcases (test results) pages. The test code is not working right yet and the function itself does not behave the way current code does. The differences in behavior between Lua and Template versions should be evaluated and synched or discussed is Lua version is considered better. Much more testing will need to be done, but this is a great start. Thanks. --Jarekt (talk) 13:03, 2 June 2014 (UTC)

Remove invalid language codes[edit]

{{editprotected}} As noted in [1] [2], Arabic_indic and Ml_old are not valid m:language codes. Can they be removed from the template? --Nemo 21:20, 6 June 2014 (UTC)

I do not have time tonight to properly investigate this, but I will. Removing those 2 would help, since we have some special handling for those. However we supported them for a while so I will try to see why were they added and by whom. By the way, we are actively working on total rewrite of this template using module:Date/sandbox. So I would not be changing the current template, especially if it is not fixing any current pages, but I would drop the support in the new module. --Jarekt (talk) 03:21, 8 June 2014 (UTC)
I think the source of those 2 languages was Template:FormatnumDigit. However it is unclear if any language uses it and they are not supported by Template:Date used to format the rest of the date-time string. I will drop them from the new module module:Date/sandbox. --Jarekt (talk) 20:28, 9 June 2014 (UTC)

exotic language support[edit]

This template supports many very rarely used languages. I have a feeling some of them are really out of whack, but since there are no speakers who ever told us there is some problem it is never corrected. for example:

  • Mongolian: {{ISOdate|1=2010-08-18 08:15:30|2=mn}} gives "", which can not be right as the year numbers use Western Arabic numerals, time numbers are in Mongolian and month is in Cyrillic. While at mn:Хэлэлцүүлэг:Нүүр_хуудас dates have format: "09:05, 16 Арванхоёрдугаар сар 2007"
  • There are more languages where year numbers use Western Arabic numerals, time numbers are not. That is unlikely to be correct
    • {{ISOdate|1=2010-08-18 08:15:30|2=te}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=th}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=bo}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=pa}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=hi}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=gu}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=lo}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=or}} gives ""
  • LTR languages also seem to be wrong. fa:بحث:صفحهٔ_اصلی shows dates in the format "‏۲۴ مارس ۲۰۱۴، ساعت ۲۲:۰۸" while our template:
    • {{ISOdate|1=2010-08-18 08:15:30|2=ur}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=mz}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=ckb}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=glk}} gives ""
    • {{ISOdate|1=2010-08-18 08:15:30|2=fa}} gives ""

In most of those languages using {{#time}} parser function defaults might be a better option. For example Mongolian or arabic:

  • {{#time:h:i:s, d F Y|2010-08-18 08:15:30|mn}} gives 08:15:30, 18 Наймдугаар сар 2010
  • {{#time:h:i:s, d F Y|2010-08-18 08:15:30|ar}} gives ٠٨:١٥:٣٠, ١٨ أغسطس ٢٠١٠

May be there is a way to look up the default date format for each wikipedia. Like "h:i, d F Y" seems to be the default for most. --Jarekt (talk) 15:15, 10 June 2014 (UTC)

Template:Date rewrite using Lua Module:Date[edit]

After extensive testing I just released a new version of template:Date 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. Since template:Date is at the core of this template, please alert me if new version causes any issues. --Jarekt (talk) 18:51, 17 June 2014 (UTC)

Formatting of timezones[edit]

The test case {{ISOdate|2010-08-18 18:15:30Z}} gives output "18 August 2010, 18:15:30", with the "Z" swallowed without trace. Could it not display it as "18 August 2010, 18:15:30 UTC", instead? See for example File:New-Years-Eve-Burnie-Bonfire-20151231-002.jpg: I'd like to declare that the date is in UTC timezone, but if I use the ISO 8601 format it won't work.

I think the formatting could also be improved for arbitrary timezones, e.g., in File:Apollo_8_Liftoff_View_(24246227076)_(2).jpg I've used -05:00, according to ISO 8601, but it's not very apparent in the formatted text that it's a timezone specifier. --ghouston (talk) 07:20, 9 February 2016 (UTC)

The main purpose of ISOdate is translation to user language. The current version of the template does not do UTC or other timezone marking, because they are rarely used and we would have to create rules for all the languages in Module:I18n/date on how to handle them. That seems too painful for such rarely used feature. --Jarekt (talk) 14:08, 9 February 2016 (UTC)
I'd say the feature is rarely used because the templates don't support them, and having machine readable date/times is a very desirable feature. Times are meaningless if you can't tell what timezone they are in. --ghouston (talk) 21:01, 9 February 2016 (UTC)
ISOdate is mostly used to format the date when photograph was taken, artwork painted, book published, etc. For most of those cases date without time would be enough. We do show time, if it was provided, but it is quite unnecessary. I do not think we need it, and do not want to commit the time necessary to add it, but if others want to add it to Module:Date/sandbox, Module:ISOdate/sandbox and Module:I18n/date and test it, I am OK with it. --Jarekt (talk) 21:18, 9 February 2016 (UTC)
You are right that it's not important in most cases, but maybe I will look at these templates some time and see what would be required to format the time zone better. --ghouston (talk) 21:43, 9 February 2016 (UTC)
I took a look at how Module:Date works, and how it uses {{#time}} for internationalization of date/time strings. It looks like {{#time}} isn't able to format an arbitrary timezone, e.g., {{#time:j F Y, H:i:s P|2000-10-10 13:55:36-0700|ru}} gives 10 октябрь 2000, 20:55:36 +00:00, with the time adjusted by the timezone offset and displayed with the user's timezone, whereas I'd want the original time and the given offset. However given that times seem to be barely touched by internationalization, I think it may be sufficient to attach a timezone, when present, in the format +-00:00, to the end of the formatted date/time string. --ghouston (talk) 06:46, 9 September 2016 (UTC)
I got it working, in the sandbox version:
1999-08-18 08:15:30Z ==>
1999-08-18 08:15:30-10 ==>
1999-08-18 08:15:30+10:30 ==>
--ghouston (talk) 08:23, 14 September 2016 (UTC)
I was thinking of including the string "UTC" before the timezone but I don't know how to internationalize it. At least the "Z" is no longer swallowed without trace. --ghouston (talk) 08:41, 14 September 2016 (UTC)
I'd be a happy user of timezone support. I often like to indicate the time a photo was taken. I think it is often useful information. And "Times are meaningless if you can't tell what timezone they are in." Often the timezone can be inferred from the context, not easily machine-readable though and not unambiguous. So thanks in advance for pinging me when it's implemented in the main version of the template! --Marsupium (talk) 13:23, 29 July 2017 (UTC)
That was quite a while ago. My proposed changes to Module:ISOdate didn't get installed (Module_talk:ISOdate). Perhaps I should just create my own ISOdate-style module and template, but I'm a bit wary of it. I'd like to convert all my own photos to local time from UTC time as stored in the camera, and display the timezone in the infobox. --ghouston (talk) 23:28, 29 July 2017 (UTC)
@Marsupium: I decided it wouldn't do much harm to make my own template/module, since it can be a relatively simple thing that takes a restricted format of input. Hence, {{DTZ}} now exists, and is tested on File:Apollo_8_Liftoff_View_(24246227076)_(2).jpg. --ghouston (talk) 07:31, 12 October 2017 (UTC)

Edit request: Heavily used template[edit]

{{Edit request}} Please add <noinclude>{{heavily used template}}</noinclude> to the top of this high use template (example). Riley Huntley (talk) 08:33, 30 April 2016 (UTC)

✓  Done --Jarekt (talk) 13:15, 2 May 2016 (UTC)

Rendering of month and day zero[edit]

Is it correct that {{ISOdate|2017-0}} is rendered to and {{ISOdate|2017-2-0}} to ? --Arnd (talk) 15:11, 19 September 2017 (UTC)

Arnd, That is due to documented feature of #time parser function. I think we should treat it as a case of garbage-in-garbage-out. --Jarekt (talk) 03:16, 13 October 2017 (UTC)
{{ISOdate|2017-02-30}} -> is another odd one. --ghouston (talk) 06:18, 13 October 2017 (UTC)
I assume the data is "normalized" by conversion from date string to a "Julian day number" by an algorithm described here. This number is an integer counting days since January 1, 4713 BC (Julian calendar). Than the number is converted to a day in whatever calendar you want. The error checking on that code must check that months are in 0-12 range and days in 0-31 days range, but more fine error checking is not performed, so one can construct an example that is not detected by the rules. The case of {{#time: Y | 2017-00-00 }}2016 is a bit troubling. --Jarekt (talk) 15:37, 13 October 2017 (UTC)

I created phabricator ticket about it. Here are some more examples

  • {{#time: M | 2017-01-00 }}Dec
  • {{#time: r | 2017-02-31 }}Fri, 03 Mar 2017 00:00:00 +0000
  • {{#time: r | 2017-02-00 }}Tue, 31 Jan 2017 00:00:00 +0000
  • {{#time: r | 2017-02-32 }}Error: Invalid time.

--Jarekt (talk) 16:10, 13 October 2017 (UTC)

Timezone[edit]

Hey, i'd like to convert the date of this file into a standard form that our templates understand. How do i add the timezone (-7.00)? I only found {{DTZ}} for it. Is this the only way? In the description of ISOdate i did not find any hint about timezones. Thanks in advance, --Arnd (talk) 08:07, 13 February 2018 (UTC)

DTZ is the only template that supports it, as far as I know. It could also be done by #invoking Module:Date, although that's a little messy to use on file pages. --ghouston (talk) 08:35, 13 February 2018 (UTC)
This way? --Arnd (talk) 18:08, 13 February 2018 (UTC)
That's right. Presumably dates will be transferred to structured data at some point, and it will be easy to convert the dates that use this template. --ghouston (talk) 21:55, 13 February 2018 (UTC)
Good. I am currently cleaning up date parameters so that most of them follow the standard or use standard date templates. --Arnd (talk) 07:52, 14 February 2018 (UTC)
At the moment none of the templates, modules and even Wikidata is not equipped to deal with timezones. I think it is generally assumed that date precision higher than a day is in the local timezone. Encoding dates in some exotic ways might make them impossible to process by various tools that might want to know the time when image was taken. And in case of this file I fill like too much info. --Jarekt (talk) 12:36, 14 February 2018 (UTC)
https://www.wikidata.org/wiki/Special:ListDatatypes has a timezone at least, so it seems like the values can be stored. --ghouston (talk) 00:39, 15 February 2018 (UTC)
And it seems like the time can include a zone as well, at least "Z" in the example given; it's perhaps confusing that it can be stored in two ways. --ghouston (talk) 00:43, 15 February 2018 (UTC)
I think particularly flowers are an example where sub-day precision and (thus) timezone make a difference and is valuable information! --Marsupium (talk) 07:49, 15 February 2018 (UTC)