Jump to content

Template talk:Date/Archive 1

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Freezing the current date

[edit]

Hi - how do I insert the current day, with a template, and have it stick, so the date stays the same and doesn't keep updating with the current day automatically? -- Stbalbach 16:24, 23 February 2006 (UTC)[reply]

The code for the template is currently:
  • {{CURRENTDAY}} {{CURRENTMONTHNAME}} {{CURRENTYEAR}} (UTC)
The problem would be solved by editing the template so that it says:
  • {{subst:CURRENTDAY}} {{subst:CURRENTMONTHNAME}} {{subst:CURRENTYEAR}} (UTC)
Is there ANY reason why this change should not be made? As it stands, I think the template is asking for trouble. Consider the case of someone who wants to automatically title their contribution to Wikipedia_talk:Userboxes/New_Userboxes by using =={{subst:date}}== ... how are they supposed to know that their contribution will be labelled forever new? Zerrakhi 15:39, 16 May 2006 (UTC)[reply]
I think then the date will be substituted when the template is saved. Whenever it is included, it will show the date when that change was made to the template! lol 'FLaRN' (talk) 23:45, 21 November 2006 (UTC)[reply]

As of right now, you can make it stick using {{subst:today}}. No fancy parameters necessary.
Note however that {{today}} is not {{date}}. -- Fullstop (talk) 06:58, 25 January 2008 (UTC)[reply]

Where do I find this template ?

[edit]

I just installed mediawiki-1.11.0 and trying to do something like {{date}} only results in the text Template:Date

I have the impression that I am missing a extension package to install ?

193.51.65.4 (talk) 12:41, 13 December 2007 (UTC)[reply]

You have to copy this template to your wiki. This template is not part of the MediaWiki package. --- RockMFR 17:21, 13 December 2007 (UTC)[reply]

Unadjusted

[edit]

The documentation says, "Dates outside that range (1970-2038) will appear unadjusted." However, the text:

{{date|March 7, 1957}}

renders as:

7 March 1957

I.E. the date is mangled into the UNIX epoch. Superm401 - Talk 05:54, 19 April 2008 (UTC)[reply]

This is a known issue - see bugzilla:11686. I'll go ahead and adjust the documentation to make note of this. --- RockMFR 14:39, 19 April 2008 (UTC)[reply]

Again, I'm forced to call the docs out:

{{date|March 7, 99}}

renders as:

7 March 1999

Keep in mind. This is an encyclopedia, and history did not begin in 1000. --Superm401 - Talk 15:45, 19 April 2008 (UTC)[reply]

Template:Death date and age

[edit]

Template:Death date and age is able to format all dates correctly. Why does this one have such problems? - TheMightyQuill (talk) 14:42, 18 July 2008 (UTC)[reply]

What do you mean? --- RockMFR 16:00, 18 July 2008 (UTC)[reply]

With this template "Dates between 1901 and 1969 will be displayed incorrectly" but no such problem exists with Template:Death date and age. Can't the code from the latter be inserted into this one, thus resolving the bug? - TheMightyQuill (talk) 16:49, 18 July 2008 (UTC)[reply]

Because that template takes the date in chunks, in numerical form. This one takes a string. Since we don't have the string parser functions (?) we use what is effectively an inbuilt function from lower down in the architecture, but that has limitations. I'm working on a fix (in my head). Rich Farmbrough, 12:40 28 August 2008 (GMT).

Format

[edit]

Is there a reason why it outputs in d MMMM format instead of MMMM d format? MrKIA11 (talk) 17:54, 30 August 2008 (UTC)[reply]

Prior date outputs request

[edit]

{{editprotected}} The output of {{date}} is today's date, namely 2 December 2024. I am in need of date-2, date-3, date-4, etc. Is there a way to set up the template to output any date prior to today? For example, if |days= 6, the output would be always be six days prior to the day in which the page is being viewed. Thanks. -- Suntag 16:19, 2 October 2008 (UTC)[reply]

You can use {{#time:j}} {{#time:F}} and create an offset. For example, without an offset, those would yield 2 December, if you wanted four days earlier you would write {{#time:j|-4 days}} {{#time:F|-4 days}} which would yield 28 November. Does that help? Shana tova!-- L'Aquatique[talk] 02:14, 3 October 2008 (UTC)[reply]
Thanks. I added the information to this template's /doc. -- Suntag 13:07, 4 October 2008 (UTC)[reply]

Name

[edit]

This really looks great, and will help in many areas. Could we consider renaming to something a bit more memorable such as "ISO2date"? --—— Gadget850 (Ed) talk - 17:44, 10 November 2008 (UTC)[reply]

That works. Now way I was going to remember the consonant soup. Thanks. --—— Gadget850 (Ed) talk - 21:10, 10 November 2008 (UTC)[reply]

Input checking

[edit]

Since Wikipedia has no agreements with its readers regarding ISO 8601, years must be in the range 1583 through 9999. Do you intend to check the input and create some red text if it fails, or will you just treat it as "garbage in, garbage out" and lay the responsiblitiy on the user?

If no checking is to be performed, may be it should be called YYYY-MM-DD2toMOS, YMD2MOS, or Numeric2MOS, or something else that does not imply that it conforms to an internatioal standard.

Also, if the ISO is retained in the name, the documentation should warns agains using it with dates that are not using the Gregorian calendar. --Gerry Ashton (talk) 21:20, 10 November 2008 (UTC)[reply]

It should be ok now that it's renamed to {{DATEtoMOS}} and you have updated the description? Nsaa (talk) 11:38, 12 November 2008 (UTC)[reply]

Restored

[edit]

I've just restored the check {{#if: ({{#time:Y-m-d|{{{1}}}}}={{{1}}} or {{#time:F j, Y|{{{1}}}}}={{{1}}} or {{#time:j F Y|{{{1}}}}}={{{1}}}). Maybe this isn't working as I supposed? (only allowing one of the three date format as valid input, and possible remove some of the guessed dates as pointed out by Gerry Ashton) and restored the bday per Wikipedia:WikiProject_Microformats (HCard/Microformat). Nsaa (talk) 11:36, 12 November 2008 (UTC)[reply]

The "bday" class is, as I suspected, used to wrap birth dates. This code was originally imported to wrap access and publication dates, and is likely to be extended to dates generally; a microformat tag would be useful, but bday is not the right one. The check above, as well as being rather inefficient, is doing... what... exactly? It functions as you suggest, but why is this a good idea? Why should we restrict it to only handling a subset of the possible date formats when it is more efficient to allow it to handle all of them?? The only current issue with the template is that the current year is assumed if it is not given; I am working on an efficient check for this. The code I have up at the moment is fractionally more efficient than the code you have restored, does not restrict us in our choice of inputs, and covers the full range of invalid date fragments (AFAIK). I don't think it gives false positives or negatives, although of course I'd like to hear of any that are found. Comments? Happymelon 15:00, 12 November 2008 (UTC)[reply]
We shouldn't allow a lot of different dates giving in as parameters. Using y-m-d will ease all further use of the variable. I think all dates if not otherwise specified should be given in the (proleptic) greorgian style, so the talk about limits from 1583-9999 is not realy relevant. If Julian dates is used, it should be another Julian date parameter in the cite template. So I go for the limited version only handling y-m-d as input (this works as shown here User:Nsaa/test2, and require this in the parameters at all templates. Nsaa (talk) 17:54, 12 November 2008 (UTC)[reply]
This defeats the whole point of the exercise: if we require all dates to be input in a particular form, then why are we bothering to reformat them at all? This is all about convenience: easy for users to enter dates, easy for the software to recognise dates, easy for browsers to render dates, easy for readers to read dates. Why on earth would we want to not "allow a lot of different dates given in as parameters"? That's the whole point of this template. Incidentally, AFAIK the current version works perfectly. Happymelon 18:14, 12 November 2008 (UTC)[reply]
I'm not a template programmer, so I'm not sure what is possible. The problem with the Julian calendar is that some valid dates will be treated as invalid, for example, February 29, 1900.
If an article references a book with a publication date given in the Julian calendar, and all the events in the article are given in the Julian calendar, what are the chances that:
  • The editor will convert the publication date to the proleptic Gregorian calendar
  • The reader will understand that the publication date is in a different calendar than all the other dates in the article, and different from what is printed in the publication itself.
As for Happy Melon's comment, there is nothing convenient about entering a date, and then having to specify the output format. It's easier to just enter it in the correct format to begin with. The only benefits to the template are (1) it can renter YYYY-MM-DD dates in existing articles to one default format, which will sometimes be the correct format for the article, and (2) it may be easier for bots to change articles from one format to another. --Gerry Ashton (talk) 18:29, 12 November 2008 (UTC)[reply]
The template is now [1] not correct. It erroneous handles {{DATEtoMOS|1901-12-14}} gives 1 January 1970 for example. I.e. the check for 0 MUST be present.
Julian dates/Swedish dates in 1700 century: We can't let people use dates as they wish. If we don't know whate date is used, it get wortless. I.e. date, accessdate, archivedate must conform to the (propletic) Gregorian calendar. And we need to add juliandate or something like that instead of date, so people can choose. Or I'm totally confused here? Nsaa (talk) 21:23, 12 November 2008 (UTC)[reply]
To extract a pertinent point from the ramblings below (:D) I think the best way to handle this is to state flat out that this template only accepts Gregorian dates. Other dates, therefore, are not processed at all... but the 'fallback' status of the template is just to print the text as it was input. So entering anything that the template can't interpret as a Gregorian date will cause that behavior. So probably we want a parallel {{Julian date}} template that does anything we can to the date to make it nicer, plus something to make it not recognised as a date to this template. That could be as simple as appending "(Julian)" to the end, which is probably something we should consider doing anyway... Happymelon 22:51, 12 November 2008 (UTC)[reply]
As I and others have said before, the legitimate issue of the template not handling dates outside the 1970-2038 range will be resolved by changes to the MediaWiki software within the next few days. Given that the template is used precisely nowhere of any importance, I really don't think there's much point in readding the check only to see it deprecated just a few days later. Of course you're welcome to restore it yourself if you believe it helpful.
I'm not sure where this discussion on the Julian calendar has come from. It is not possible to switch between calendars, it never has been and it never will be. No template, no matter how clever, can distinguish between Julian and Gregorian dates because they use the same syntax; indeed this is the main source of the problems with them. The solution, as would be necessary with any version of this template, is to stick a big message in the documentation reminding people that the template is not for Julian dates. We then include an option (through setting, say, {{DATEtoMOS|5 July 1465|jul}}) which causes the output to be returned unformatted. Perhaps "na" or "plain" would be more useful than "jul", as this 'format' could have other uses whenever it is undesirable for the date to be reformatted. Then in the 95% (probably more like 99%, but meh) of cases where the dates are in the Gregorian calendar, no further work needs to be done. In the uncommon but acceptable case where the Julian (or indeed some other) calendar is used, one extra setting is sufficient to resolve all issues.
Vis your second point, I honestly don't understand your argument. If it were "easier to just [require editors to] enter it in the correct format to begin with", there would be no purpose to this template whatsoever. The reason for this whole discussion is that we already have a situation where there are a terrifying number of dates all across en.wiki which are not in the correct format, and so rather than going to the titanic effort of fixing both the existing inconsistencies and the errors that will appear on a continuous basis, we have the opportunity to instead achieve the same result with just a handful of careful edits. You are simply mistaken to believe that requiring editors to adapt themselves to rigid formatting requirements when they can instead be automagically applied by some simple code is in any way "easier". Both the benefits that you point out exist, but they pale in comparison beside the ability to fix quickly and easily the ungodly mess that we have dug ourselves into over seven years of sloppy editing and partial fixes. Happymelon 22:33, 12 November 2008 (UTC)[reply]

First you have to decide what the goal of the template is. Is the goal strictly to rearrange the order of the date elements (month, day, and year)? If so, the best choice is a character based solution, that just moves the characters around, and in some cases, changes between numerals and letters for the month. If the goal is to provide accurate information about what the date is, then it would be necessary to specify the calendar, but just who is going to consume that information? What person or application cares whether the date is Julian, Gregorian, or something else, and is that person going to try to obtain that information from that template?

Or is this a case that the crappy programming environment can't do characters, so the editor must specify when the Julian calendar is being used just to help out the inadequate programming environment. My attitude is, if you need a chisel and all you have is a screwdriver, go on strike until the proper tool is provided. --Gerry Ashton (talk) 21:34, 12 November 2008 (UTC)[reply]

Given that the third alternative is to find a piece of metal, make a chisel, and thereby solve the problem both for yourself and for other users, I'm very surprised by that attitude. It seems to be the antithesis of the community spirit that drives this project forward. Happymelon 22:33, 12 November 2008 (UTC)[reply]
You are correct in saying that we must be clear in the goals of this template. However, we must also be both realistic and ambitious; we should aim to do whatever is possible to do elegantly and efficiently in one template, and no more. Can we rearrange the order of the date elements? Yes. Contrary to your statement, however, this should not be done using simple text manipulations, even if they were available (they aren't). To do so would be a pointless reinventing-the-wheel exercise given that a carefully designed and tested set of date-handling functions already exist in the PHP software that underlies MediaWiki, have been neatly wrapped up in wikimarkup, and will be available for us to use in just a few days time. Dates, as I know you realise, are complicated and irregular objects that cannot be easily manipulated by computers; there innumerable pitfalls in doing so, some of which we have recently discovered.
I'm not sure I understand what you consider as your other "goal". What, exactly, constitutes "accurate information about what the date is"?? A date is a date: they come in many formats and this template attempts to regularise those, but it cannot ever tell you whether the date is 'correct' or not. If you put garbage (like 0 January) into the template, you will of course get garbage out. If you put in something that looks like garbage but actually isn't (ie unusual Julian dates) it is not unreasonable for the template to need some prompting that it shouldn't choke on them; in this case we can instruct the template to not try and do anything clever by appending anything, even a full stop, to the date. Of course we can be rather cleverer than that, and maybe take the time to explain the calendrical difference at the same time. That's not an issue for this template, it's an issue for whatever data is entered into it. Happymelon 23:10, 12 November 2008 (UTC)[reply]
I don't know how to provide character-manipulation functions in the template programming environment. I understand that a bug exists requesting this, but it has not been acted on. --Gerry Ashton (talk) 22:53, 12 November 2008 (UTC)[reply]

Problems with comparison

[edit]

I've just allowed ymd as input in User:Nsaa/test2, and it works very fine for all the problematic dates. But it will not handle dmy and mdy. In User:Nsaa/test I have only allowed dmy and there's seems to be a problem with #if / #ifeq. (({{#ifeq: {{#time:F j, Y|{{{1}}} }} | {{{1}}} |1 | 0}})) equals 1 even if the input is 2008-01-02 and {{#time:F j, Y|2008-01-02 }} = 2 January 2008. For me 2 January 2008 isn't equal to 2008-01-02 but the #ifeq: interprets it like that. Bug? -> Solution here is to only allow ymd as input. Nsaa (talk) 14:18, 12 November 2008 (UTC) Nsaa (talk) 14:18, 12 November 2008 (UTC)[reply]

Short answer: that's not a solution, that's trying to sweep the problem under the carpet :D. I have to go away for a bit ATM, but I'll give this a kick when I get back. Happymelon 15:00, 12 November 2008 (UTC)[reply]

Replace {{date}}?

[edit]

This template now contains all the functionality of, and is technically far superior to, the code at {{date}}. If there are no objections, I am going to history-merge the template, talk and documentation pages together to replace {{date}} with this new code. Comments? Happymelon 15:58, 17 November 2008 (UTC)[reply]

Does that mean that existing invocations of {{Date}} will remain functional? If so, I would welcome your proposal. Which leaves the question: which one should be the preferred template? Michael Bednarek (talk) 08:47, 18 November 2008 (UTC)[reply]
{{date}}, certainly, it has a much more memorable name :D Happymelon 08:55, 18 November 2008 (UTC)[reply]
I have now done this: welcome to Template talk:Date! Happymelon 16:21, 21 November 2008 (UTC)[reply]

Happy-melon: For compatibility fixes see {{User talk:Fullstop/Sandbox/T1}}, which has all the functionality of the previous date. I've also fixed a couple of minor things: A) specifying the dateformat in uppercase is equivalent to 3rd arg=y. The third argument is then superfluous. B) requiring the "none" parameter for pre-Gregorian dates is no longer necessary since the template can figure this out itself (incidentally: for neither the template nor #time have any technical "problem" with dates before 24 February 1582. Neither the template, nor #time do any math on the date, and "{{#time:F j, Y|14 October 1066}}" => "October 14, 1066" is perfectly fine.) -- Fullstop (talk) 21:13, 21 November 2008 (UTC)[reply]

Fullstop, please see User:Gerry Ashton/sb-DATEtoMOS. Your statement that "requiring the "none" parameter for pre-Gregorian dates is no longer necessary since the template can figure this out itself" is too vague for me to tell if your template does what you expect for the Julian date February 29, 1500 (It formats it as 1 March 1500)
Also, your statement that "Neither the template, nor #time do any math on the date" is belied by the behavior for February 29, 1500. --Gerry Ashton (talk) 21:32, 21 November 2008 (UTC)[reply]
  • I looked at User:Gerry Ashton/sb-DATEtoMOS, and the only difference I can see between my version and {{date}} is that in my version "December 32, 2008" is formatted as "1 January 2009" while {{date}} ignores it. I have no idea why (since the two templates work the same way), but so what? "December 32, 2008" is just as invalid as February 31 or all the other corner cases collected on sb-DATEtoMOS. As the template's documentation already says, it is beyond the means of this template to catch invalid inputs. #time is doing that well enough, perhaps not ideally by your measure, but well enough for pretty much everyone else.
    That goes for date's handling of the leap day in 1500 as well, which by Gregorian rules was not a leap year, and since #time is proleptic, that's how it gets done. This method coincides perfectly with virtually all articles; e.g. as far as every history book is concerned, the Battle of Hastings took place on 14 October 1066. End of story. No one cares (or needs to care) that in 1066 neither the Normans nor the Britons used either a Julian or a Gregorian calendar.
  • Re: "none". The template documentation states: This template should only be used to format dates in the Gregorian calendar, and in the range AD 1583 through AD 9999. Dates in other calendars, such as the Julian calendar, can still be given using this template, but remember to set the output format to "none" (eg 29 February 1700). In my version, it is not necessary that the editor "remember to set the output format to 'none'". The template will do this automagically. (In my opinion, it should do this only for dates < 1000, and that too only for cosmetic reasons, but I'm well aware of your position on Julian/Gregorian issues).
  • These Gregorian/Julian issues are in any case unrelated to the purpose of my fixes, which are to address the "now contains all the functionality" problem. All this Gregorian/Julian stuff just muddles the issue. -- Fullstop (talk) 23:53, 21 November 2008 (UTC)[reply]
Fullstop wrote "In my version, it is not necessary that the editor "remember to set the output format to 'none'". The template will do this automagically." I take that to mean it will set the output to none whenever it thinks a date is in the Julian calendar. What the criteria for determining that is not stated. Certainly any program trying to detect Julian dates would consider dates in 1500 to be Julian. In the version of Fullstop's sandbox that existed at the time I made my comment, it changed February 29, 1500 to 1 March 1500, so that version plainly did not do the same thing as entering the "none" parameter would have acomplished. Since that time, Fullstop's sandbox has been changed so it does not reformat that date.
As for Julian/Gregorian stuff muddling tie issue, the user can put in exactly the right date by just getting rid of {{Date}} and copying the users exact keystrokes from the cite web template to the output. If {{Date}} can't handle Julian in a way that is both sensible and well-documented, it should not be used.
In particular, {{Date}} should not invent any new arbitrary transition dates, such as 1 January 1000. It would be appropriate to use a transition date imposed by others. Pope Gregory XIII established one obvious transition date, 15 October 1582. The ISO established another one, 1 January 1583, by requiring those adhering to ISO 8601 to not use earlier years except by mutual agreement. --Gerry Ashton (talk) 02:45, 22 November 2008 (UTC)[reply]
What on earth are going on about? The reference to "Julian/Gregorian stuff muddling the issue", is a reference to your muddling the issue. The issue is a "now contains all the functionality" problem. NOT Julian/Gregorian stuff.
If you don't like date, don't use it, and don't lose sleep over people who do! And the 1000 cutoff would have been -- as I clearly said -- for cosmetic reasons. To end the incessant Julian/Gregorian noise, I've now removed all cutoffs; the template now deals with pre-Gregorian dates just as #time does (and hence date also), i.e. proleptically. Its documented. Enough already! -- Fullstop (talk) 04:20, 22 November 2008 (UTC)[reply]
Since date is being considered for use in the cite xxx family of templates, the date template is likely to be shoved down my throat whether I like it or not. The sandbox version now seems to behave in a predictable manner that should be easy to document (the present documentation of {{Date}} will need some minor fixes). --Gerry Ashton (talk) 04:51, 22 November 2008 (UTC)[reply]

Sorry, can we please take three steps back and sort out what the actual issues are, before arguing over implementations?? Comparing the first to final revisions of your sandbox, Fullstop, I don't fully understand the purpose of your changes. Could you explain what "compatibility fixes" you think are required? I am also unconvinced by the usefulness of overloading the second parameter: capitalisation is not an intuitive way of specifying a link, and it precludes us from, for instance, making the parameter case-insensitive. That means that there are strings containing the letters "m", "d" and "y" which do not form valid inputs to the template: "mDy", for instance, or "Dmy". I don't see any issues with using a third parameter for the link switch: is there something I am missing? I suspect and fear that your edits are an attempt to make the template more 'intelligent' as to whether a date is Julian or Gregorian. It is simply not possible to do this reliably or efficiently, not when there are four centuries of overlap between the two calendars. Rather than trying to be clever with a system that is not logically consistent and hence extremely difficult for computers to understand, we should be relying on the collective intelligence of our thousands of editors to identify which dates can be legitimately 'played around with' and which should be left alone. Happymelon 18:48, 22 November 2008 (UTC)[reply]

1. In your top post in this section you said "This template now contains all the functionality [etc]." That is not correct. The old {{date}} had functionality that the new {{date}} does not. I.e. "November 24" was recognized in the old {{date}}, just as it is of course in date linking also.
2. Your comment re: Julian/Gregorian shows just how badly Gerry Ashton has screwed up this discussion. I don't give a damn about Julian/Gregorian, nor does the template, and in all likelihood nobody else does either. How often will it be necessary to say "The issue is a "now contains all the functionality" problem. NOT Julian/Gregorian stuff."?? I have said this several times now, so I'm really quite surprised by the "I suspect and fear that your edits are ..." etc. I have now marked-up the sentences in bold green. Will it be necessary to make them 72-point blinking red before the infernal GerryAshtonesque Julian/Gregorian noise stops?
I will address the so-called "overloading" when these two points are settled. -- Fullstop (talk) 15:07, 24 November 2008 (UTC)[reply]
Your response doesn't answer my question, hence the hyperbole is useless as well as somewhat incivil. What functionality does the new template not support that the old template did? How does your code resolve the issues? Why is it necessary to overload the format parameter? I know there is an issue, I noticed your four comments even before you highlighted them. Putting them in 72 point blinking red won't give them the psychic powers to convey exactly what issues they are refering to, and without that I'm powerless to help you. Happymelon 16:00, 24 November 2008 (UTC)[reply]
<quote>I.e. "November 24" was recognized in the old {{date}}, just as it is of course in date linking also.</quote> -- Fullstop (talk) 16:03, 24 November 2008 (UTC)[reply]
"recognised" how? It's a date fragment, not a full date. What is the template supposed to do with it? Can we have some wider input please: should this template attempt to format date fragments? How would we handle the "ymd" format? What about linking? Happymelon 22:54, 24 November 2008 (UTC)[reply]
It seems to me there is nothing meaningful this template can do when invoked as {{Date|November 24}}. Why anybody would ever enter such a thing is beyond me, and IMO they deserve everything they get. Michael Bednarek (talk) 01:41, 25 November 2008 (UTC)[reply]
If you have dmy (for example) set in your userprefs, the following will appear the same:
Now do it with {{date}}:
  • {{date|November 24}}-{{date|November 25, 2008}} => 24 November-25 November 2008
  • {{date|24 November}}-{{date|25 November 2008}} => 24 November-25 November 2008
Not same. "Ooops", eh? {{Now do it with User talk:Fullstop/Sandbox/T1}}
  • {{....T1|November 24}}-{{....T1|November 25, 2008}} => {{subst:empty template|This template must be substituted. Replace {{ with {{subst:.}}{{date|{{subst:#time:F j, Y|}}}}-{{subst:empty template|This template must be substituted. Replace {{ with {{subst:.}}{{date|{{subst:#time:F j, Y|}}}}
  • {{....T1|24 November}}-{{....T1|25 November 2008}} => {{subst:empty template|This template must be substituted. Replace {{ with {{subst:.}}{{date|{{subst:#time:F j, Y|}}}}-{{subst:empty template|This template must be substituted. Replace {{ with {{subst:.}}{{date|{{subst:#time:F j, Y|}}}}
Amazing, huh? -- Fullstop (talk) 05:25, 25 November 2008 (UTC)[reply]
Whats with the "date fragment" stuff? "November 24" is a valid date in every calendar in the western world, and the title of an en:wiki article. Its not a canonical date, but it warrants (and receives from DateFormatter) a field swap like any other date, so-called "fragment" or otherwise.
And (ignoring the remarkable redefinition of 'ymd'**) 'ymd' is obviously handled as one would expect it to be handled, i.e. without 'y' effectively the same as 'mdy'. Just as the MediaWiki's DateFormatter does it, and which has been done that way ever since there has been date formatting.
Linking is obviously not a problem either, and requires no special treatment that wouldn't be given to any other date.
But these things should not require "discussion" as if they were bizarre and out of this world. From the tone of the comment immediately above this one, and the skepticism oozing out of the one before that, one might be misled to suppose that that {{Sandbox/T1}} was something from the depths of hell and about to destroy all humanity. Neither is it that, nor is it so different from {{date}} that one cannot recognize its origins in {{date}}, nor is it particularly complicated, or in any way different from the way date formatting actually works.
Instead of a "hey, cool", I get oodles about unrelated stuff from one editor, remarkably closed-minded notions from another, and unreflected suppositions from a third. Wtf? Reality check: You copied your template from someplace to here without getting feedback here first, then suppose that I can read your mind and will know all about the stuff you were discussing out there whereever it is you all came from, and now in the latest incarnation, presume to know what is and isn't "meaningless". Rock that does not.
Perhaps this would be a good time to ask what the point of this template is anyway? Its neither a substitute for the old {{date}}, nor a replacement for {{FULLDATE}}, nor is it designed to make [[autodate]] syntax redundant (which it cannot do anyhow), nor does it fill the vacuum left by MOSNUM's deprecation of linked dates (though it may have had that intention originally), nor is it -- with its horrific anonymous parameters -- anything but a prototyping dead end for a "memorable" name. Allusions to {{cite}} suggest that is is/will be called by {{cite}}/{{citation}} (which is what the old {{date}} ended up doing), but that would be special purpose and ought to be sub-routines of those templates, and neither need linking nor four dateformats. So, what exactly is this template good for? -- Fullstop (talk) 05:25, 25 November 2008 (UTC)[reply]
** (from the incorrect implementation in {{date}} it would seem that "ymd" is being redefined to be something that it isn't; December 2 is obviously not "ymd", but for the purpose of Happy-Melon's question irrelevant since DateFormatter's output for ymd/iso/mdy are all the same when there is only day+month)
Again: why anybody would want to enter {{Date|November 24}} is beyond me. If I want a linked date in a certain format, I write it that way: November 24 or 24 November or Nov 24 or 24-Nov or 24 novembre. Why should I try to work out how to coax a template into a behaviour which I can achieve much easier by writing it down myself? Michael Bednarek (talk) 06:45, 25 November 2008 (UTC)[reply]
For exactly the same reason why anybody would want to enter {{Date|November 24, 2008}}.
1. It is always "much easier" to write things down yourself than to call the template, irrespective of whether this is for linked or unlinked dates, or whether for day+month+year or just day+month.
2. It so happens that [[dateformatting]] has a well known syntax that works for both day+month+year and just day+month. Thats the threshold of acceptance if {{date}} hopes to fill that MOSNUM void.
3. {{date}} had this functionality. Irrespective of whether it was "meaningless" or not, it was there before, and if a new template purports to "contain all the functionality", then it better well have all the functionality. Its not possible to know how this template is being used in the wild.
4. Not dealing with all dates as dates is inconsistent. Things should just work. In a uniform, predictable fashion without (or as few as possible) ifs, thens, or buts.
5. Why on earth am I being required to go to such lengths to justify such a triviality? There is absolutely no reason why 'November 24' rewriting should not be done. Its already done. So the question is really why are y'all being so gawd-awfully uptight? -- Fullstop (talk) 09:18, 25 November 2008 (UTC)[reply]
Fullstop is right. For those prepared to take the extra effort, it will always be quicker to write out exactly what you want to say. This template is for the 99% of people who would rather jot it down quickly and let the software do the work. Now that I see what you're trying to achieve, your sandbox code makes considerably more sense. The only phrase I still don't understand is line 15; the clause {{#ifeq: {{#expr: {{#time:Y|{{{1|}}}}} <1 }} | 1 | none | ... will always return false, as that time expression cannot AFAIK return a negative value: years in the range 0000-0069 equate to the years 2000-2069, the years 0070-0099 equate to the years 1970-1999, and negative years are not supported at all (are discarded). Hence I think this clause is defunct. I also don't understand the purpose of the repeated {{#expr:{{ #time:Y|{{{1|}}} }}}} constructs - all they appear to be capable of doing is passing the year through if it is valid, and obfuscating any errors that are thrown (commuting "invalid time" to "unexpected < operator"). What are they supposed to do?? Other than these, your code is actually very elegant and not significantly less efficient than the current version; my apologies if you thought I was treating it as "something from the depths of hell"; it was just difficult to comprehend without knowing what it was trying to achieve. Most importantly, code that I initially believed to be testing for year ranges (hence calendrical differences) actually does nothing of the sort; you are quite right that the Julian/Gregorian issue is at best tangential to this specific discussion. Can you explain the purpose of the two clauses above, please? Happymelon 14:02, 25 November 2008 (UTC)[reply]
1. yep, the clause is defunct, and has been removed. Cf. point #3 below.
2. but the switch clause is still not as simply as I had hoped it would be. I had to make it a bit more robust to differentiate between 'no argument' and 'argument == ""' as in {{...|25 November 2008|}} (the current date doesn't have this problem because "" is caught by the #default). So a simple {{{2|dmy}}} had to become {{#ifeq:{{{2|}}}||dmy|{{{2|}}}}}. *Grmbl* Perhaps that can be simplified a bit. Need sleep.
3. The expr in {{#expr:{{ #time:Y|{{{1|}}} }}}} ensures that there are no leading zeros. Compare {{date|1 January 999}} => 1 January 999. Heaven forbid that such a thing should appear, but one never knows. Looping back to point #1: I had originally done {{#expr: {{#time:Y|{{{1|}}}}} <1000 }} to prevent years with only 3 digits from being processed. I still think years < 1000 should be "asis" for readability/maintainability reasons. Or at least until there is a demand for 3 digit years, which may be never. -- Fullstop (talk) 18:07, 25 November 2008 (UTC)[reply]
The best I can construct is User:Happy-melon/sandbox1, it streamlines things as much as I can think of at the moment, and separates the two optional parameters out again. I'm not convinced that merging them is a good idea. The cascade order on that isn't perfect, but the only 'error' is never to link dates when a garbled dateformat is input... oh diddums :D. It also fixes a few errors in some of the date formats that are present in the current version; linked dates in the 'iso' format are not actually recognised by the MediaWiki date autoformatter. What do you think? I agree with you to a certain extent about pre-1000AD dates, although I can think of a more efficient way of coding that, the principle is the same. Given that there are inconsistencies in the handling of pre-100AD dates anyway, and that dates pre-1000AD increasingly need the "AD" prefix for clarity, I'm inclined to support a cutoff at at lowest 1000AD. As mentioned above, though, perhaps placing it at the 'beginning' of the Gregorian calendar in the 16th century would be more sensible? Thoughts? Happymelon 19:37, 25 November 2008 (UTC)[reply]
Excellent! And if {{#ifeq:{{{3}}}|y|L}}{{lc:{{{2|}}}}} is changed to {{#ifeq:{{{3|}}}|y|l}}{{lc:{{{2|}}}}}, the third argument becomes superfluous; The editor just needs to call the template with "ldmy", instead of "dmy|y", and doesn't tie up another anonymous parameter (so making future expansion possible).
I've synchronized the two versions at User talk:Fullstop/Sandbox/T1, incorporating the switch cmd simplification (with lowercase "L" as noted), and the #time rule fixes. I then added a filter for years < 1000 and simplified the #time rules even further.
I would even consider discard "iso" output altogether; its deprecated by MOSNUM (and not supporting it would spare us discussions about "iso" not really being "iso"), so let someone actually request that functionality first.
Re: 1582 as a cutoff. I agree in principle, but for 1000-1582 its only five missing Feb 29s that are a problem. Moreover, the changeover only occurred for 4+4 countries in 1582; it occurred later (sometimes /much/ later) for [#Gregorian_date#Timeline|most of the world]. In effect, a 1582 cutoff merely cuts of the fewest possible occurrences of a missing Feb 29. -- Fullstop (talk) 19:49, 26 November 2008 (UTC)[reply]
Looking good now! I could improve further only by sacrificing clarity: it's possible to convert to a #switch statement for the various date fragments using the somewhat esoteric overload rules for #time, an extension of what's already being used to test for absence of years. It's very obfuscated though, and we're getting diminishing returns here. I think this is as efficient as we're going to get it. One thing: neither of our test versions correctly handle {{date|January 1783}}; they both currently add an implicit day (the 1st, bizzarrely enough, not the current day). I'm not inclined to consider this a showstopping problem; your thoughts? Happymelon 22:14, 26 November 2008 (UTC)[reply]
  • There is another way to simplify the switch:
{{#time: {{#switch ...<select rule>... }} | {{{1|}}} }}
but requires moving the asis/none tests out of the switch.
  • Apropos "January 1783": As you identified, the crux is to differentiate "January 1 1783" from "January 1783". That can be caught with {{#time:j|2000 {{{1|}}}}} which will throw an error if "1" is explicit, and return j=1 if "1" is not explicit.
{{#iferror:{{#time:j|2 {{{1|}}}}}|have day num| <!-- "dmy" or "iso" or no date -->
{{#iferror:{{#time:j|2000 {{{1|}}}}}|have day num|no day num }}}} <!-- "mdy" -->
But this will not work for "1783 January" (or just plain "January"). The {{#time:j|2000 {{{1|}}}}} is relying on a bug that could be fixed at any time, and so should not be relied on to work in the future. On the other hand, its likely that when the bug is fixed "2 January 1 1783" will throw, in which case it will be caught in the first #iferror. -- Fullstop (talk) 02:08, 27 November 2008 (UTC)[reply]
I agree with your last comment vis January 1873: we can't rely on that rather esoteric method working into the future, and if the bug is fixed it will result in a change in behavior which we may find hard if not impossible to reverse. Since it's not a very common occurence anyway and even this hack is not foolproof, I'm inclined to avoid handling it now. Thoughts? Happymelon 10:16, 27 November 2008 (UTC)[reply]

(outdent)

I've thought about this a bit more in the meanwhile, and withdraw my objection. While {{#time:j|2000 {{{1|}}}}} is a remarkable thing to do for detecting the presence of an explicit day number, it is ok in the way it is being used. This is because ...
  • if the bug that makes {{#time:j|2000 {{{1|}}}}} special were fixed, then the template would behave as if there was no "January 1873" checking to begin with, i.e. just as it is now. From the programmatic point of view, the tests don't look for day numbers, but looks to exclude dates without day numbers. If functionality were to change, there would only one kind of error: day numbers would be detected even if they weren't there. But there would not be any cases where day numbers were erroneously thought to be missing. The false positives would merely cause the template to behave as if "January 1873" were the same as "January 1 1873", which is as if there were no handling to begin with, i.e. just as it is now.
  • the {{#time:j|2000 {{{1|}}}}} is preceded by a {{#time:j|2 {{{1|}}}}} test, which is a legitimate test for a duplicate day number. The second test is only needed because the first does not throw an error for "2 January 1 1873" (it throws fine for "2 1 January 1873" or for "1873-01-01"). If the bug were fixed, it would catch "2 January 1 1873" too, and then the secondary {{#time:j|2000 {{{1|}}}}} would not get executed.
  • A real problem with these two will only occur if in the future invalid dates did not throw at all (e.g. if "2000 January 1873" were treated as valid), in which case {{date}} would have a general problem with invalid input.
It is also possible to ensure that these tests only runs under the conditions known now. The tests would then not be done if those conditions were not the same. If the tests are not done, then {{date}} would function as if there was "January 1873" handling didn't exist. But as described above, these additional condition checks are not really necessary. -- Fullstop (talk) 04:12, 28 November 2008 (UTC)[reply]

Good templates tend to get embedded in other templates, and the documentation of the using template may or may not reflect the limitations of the good template. A requirement that y > 0 or y > 1582 are both defensible. An unexpected requirement such as y > 1000 is apt to suprise the user of some other template that includes {{Date}}. I'm afraid I don't quite see the asthetic problem that concerns Fullstop. --Gerry Ashton (talk) 21:07, 26 November 2008 (UTC)[reply]

I'm inclined to agree that the cutoff should be set at 1582. Remembering that all that happens before this date is that no formatting is applied, it seems a sane and sensible thing to do. Happymelon 22:14, 26 November 2008 (UTC)[reply]
Fine by me. I have been there before. -- Fullstop (talk) 02:08, 27 November 2008 (UTC)[reply]
I've reconsidered this as well.
  • Gerry's "A requirement that y > 0 or y > 1582 are both defensible" argument is invalid, as y > 0 is incorrect. The lower limit is 100, which is not more/less "defensible" than 1000.
  • Besides having been mentioned before, the aesthetic problem should be obvious: 0666 is not a valid link, and "6 June 0666" looks like hell. ;)
Its also possible to simply not format dates that evaluate to March 1 of the problem years < 1582. Tossing 541289 good days because of 12 bad days (or 212571 good days for 5 bad days) is tossing the proverbial baby with the bathwater. -- Fullstop (talk) 04:12, 28 November 2008 (UTC)[reply]

Date fragments

[edit]

Since the methodology of Fullstop's sandbox date fragment handling is not documented, I'm going to guess that it treats it as a date in the current year, and just does not display the year when it produces output. If so, it would treat the date fragment "February 29" differently in leap years than in common years; in leap years it would be rendered correctly but in common years it would be rendered as "March 1". --Gerry Ashton (talk) 17:16, 25 November 2008 (UTC)[reply]

Good catch. Fixed. The year merely needed to default to a leap year, e.g. 2008 ;) -- Fullstop (talk) 18:07, 25 November 2008 (UTC)[reply]

Prior dates

[edit]

XfDs typically have a five day review period, which started on 26 November 2024. The code

{{#time:j|-6 days}} {{#time:F|-6 days}} {{#time:Y|-6 days}}

produced the prior date. See prior discussion. I just used this feature on Template:Mfdbacklog for MfD discussion. However, Template:Date/doc doesn't seem to provide much details on this valuable feature. Please consider revising Template:Date/doc to provide information on prior date outputs. Thanks. -- Suntag 19:23, 25 November 2008 (UTC)[reply]

The purpose of this template is not to provide date mathematics such as you describe, although the feature is indeed extremely valuable. For this particular template we are trying to suppress the date mathematics behavior, not encourage it. I'm sure there is another template in Category:Date mathematics templates that does or should do what you suggest, and if not, one should certainly be created. Incidentally, note that your example can be more efficiently written as {{#time:j F Y|-6 days}} → 26 November 2024. Happymelon 21:19, 26 November 2008 (UTC)[reply]
1. yes, simplify {{#time:j|-6 days}} {{#time:F|-6 days}} {{#time:Y|-6 days}} to {{#time:j F Y|-6 days}} (alternatively, since you posting this here, {{date|{{#time:j F Y|-6 days}}}})
2. use subst: so that the date doesn't keep changing. See {{Refu-c}} for an example. -- Fullstop (talk) 22:02, 26 November 2008 (UTC)[reply]

Bug for YYYYMMDD input

[edit]

It looks like inputs in the YYYYMMDD format are not processed correctly; see the examples on the doc page. -- Jitse Niesen (talk) 17:48, 18 December 2008 (UTC)[reply]

2004 problems

[edit]

{{date|2004-01-09|mdy}} outputs "January 9" instead of "January 9, 2004" (January 9, 2004). --Joshua Issac (talk) 18:18, 22 December 2008 (UTC)[reply]

{{editprotected}}

Joshua Issac has discovered a (yet another) bug in PHP's Date class.
The solution is to change:
{{#ifeq:{{#time:Y|{{{1|1 Jan 2000}}} 1996}}{{#time:Y|{{{1|1 Jan 2000}}} 2004}}|19962004
to
{{#ifeq:{{#time:Y|{{{1|1 Jan 2000}}} 2008}}{{#time:Y|{{{1|1 Jan 2000}}} 2004}}|20082004
The reason for that lies with a bug in PHP's Date (and hence {{#time}}), which causes 1960-1999 dates to be treated differently from any other.
With that bug, {{#time:Y|{{{1|2004-01-09}}} 1996}} => 1996 is incorrect.
The correct result would be 2004. Compare: {{#time:Y|{{{1|2004-01-09}}} 2008}} => 2004.
click [show] for more              
{{#time:Y|{{{1|2004-01-09}}} 1796}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1096}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1896}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1906}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1916}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1946}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1956}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1959}} => 2004 (should be 2004)
-- bug begins...
{{#time:Y|{{{1|2004-01-09}}} 1960}} => 1960 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1961}} => 1961 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1966}} => 1966 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1976}} => 1976 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1986}} => 1986 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1996}} => 1996 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 1999}} => 1999 (should be 2004)
-- bug ends
{{#time:Y|{{{1|2004-01-09}}} 2000}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 2001}} => 2004 (should be 2004)
{{#time:Y|{{{1|2004-01-09}}} 2002}} => 2004 (should be 2004)
-- Fullstop (talk) 20:06, 22 December 2008 (UTC)[reply]
 Done Happymelon 13:22, 23 December 2008 (UTC)[reply]
Thank you. -- Joshua Issac (talk) 23:45, 24 December 2008 (UTC)[reply]

Bug for the ymd output

[edit]

The output for ymd should be YYYY-MM-DD (as in ISO 8601), not YYYY-MMMM-DD (this is a non existent format)? Ex. 20 December 2008 gives {{Date|20 December 2008|ymd}} → 2008 December 20 [2], but it should give 2008-12-20. Nsaa (talk) 21:38, 22 December 2008 (UTC)[reply]

Check your Special:Preferences. Whether its meaningful or not is another issue. ;) -- Fullstop (talk) 22:11, 22 December 2008 (UTC)[reply]
Ahhh... I now realized that iso and ymd was parted in two and I see that ISO was reinserted in the description. Thanks for that. I think ymd should do the same as the iso-parameter. There are nobody using the yyyy mmmm dd (eg 2008 December 25) format. The ISO-format is covered by MOSNUM, see Wikipedia:Mosnum#Dates which states "However, they may be useful in long lists and tables for conciseness.". Nsaa (talk) 09:17, 25 December 2008 (UTC)[reply]
It does not make sense to coin a new term for what everyone knew/knows as 'iso [xxxx]', nor should 'ymd' be recycled to mean something other than what MediaWiki uses it for. That does not of course preclude that the 'ymd' keyword vanish (either completely, or only from the documentation). -- Fullstop (talk) 11:36, 26 December 2008 (UTC)[reply]
ps: example of ymd usage that I ran into a few hours ago. I've seen numerous far-east articles with it. -- Fullstop (talk) 17:09, 26 December 2008 (UTC)[reply]
The example dosn't follow WP:MOSNUM as far as I can see. Again I will claim that the ymd format on the form yyyy mmmm dd is not according to MOSUM, nor is it standardized (I've seen it used in some Chinese films so it's in use although). Nsaa (talk) 14:24, 30 December 2008 (UTC)[reply]
What's your point? That ymd doesn't adhere to mosnum is not news. The template doc explicitly states that only mdy/dmy are mosnum-conform. What more is there to say? -- Fullstop (talk) 18:39, 30 December 2008 (UTC)[reply]
What more is there to say? - So there was an error in the section heading; and that it's about as useful as a wet sock, I guess (ie better than no sock at all). ;-) Ohconfucius (talk) 02:33, 31 December 2008 (UTC)[reply]

Bad comma breaks {time}

[edit]

The examples in the doc previously included

{{date|24 June, 2006}}

{{#time}} cannot in fact handle that:

{{#time:d F Y|24 June, 2006}} => 24 June 2024

Note the year. I've removed that example from the doc. -- Fullstop (talk) 23:06, 22 December 2008 (UTC)[reply]

Other date templates; and microformats

[edit]

I have already added a note to {{Date}}'s documentation, about the fact that it does not emit the classes used in microformats like hCard and hCalendar. These are emitted, by templates like {{Start date}} and {{End date}}, but the issue is complicated by the fact that different classes in different circumstances. It also seems to me that those and other date templates:

could usefully be rationalised through merging. Andy Mabbett (User:Pigsonthewing); Andy's talk; Andy's edits 20:26, 27 December 2008 (UTC)[reply]