If you have made any changes to the code of this template you need to purge this page to see the changes in these examples.

none

edit
{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01}}

Generates: "Example". Example Inc. (2008-01-01). Retrieved on 2008-01-01.


Current coding error

edit

NO red-linked dates, i.e. 2008-01-01, if a user has no date preference set, in this example where hard coded date stylining (so why previously failed using a metatemplate for simpler coding ?) David Ruben Talk 17:37, 14 July 2008 (UTC)

NB meta:Help:Date_formatting_and_linking#Accessibility of date preference for branching states "The date format cannot be detected with #ifeq, because the date format is converted after expansion of parser functions." so not possible, it seems to detect user date format within a parser function. Is this why pervious metatemplate works on its own but not within another parser fuction ? Get rid of format test therefore in this example - hence entries either:

  1. Wikified showing user-preference but for majority of users (who have not set ther preference and the case for all anons) as a blue linked ISO YYYY MM-DD
  2. Else one of 3 editor-selected unlinked fixed formats.

blank

edit
{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=}}

Generates: "Example". Example Inc. (2008-01-01). Retrieved on 2008-01-01.

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=dmy}}

Generates: "Example". Example Inc. (1 January 2008). Retrieved on 1 January 2008.

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=mdy}}

Generates: "Example". Example Inc. (January 1, 2008). Retrieved on January 1, 2008.

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=2008-01-01|date=2008-01-01|datestyle=ymd}}

Generates: "Example". Example Inc. (2008 January 1). Retrieved on 2008 January 1.

Pre 1970 issue

edit

Because Unix cannot handle dates before 1970, these can not be converted into date styles by the wikipedia parserfunction {{#time: }} function:

Hence {{#time:Y-m-d|1975-09-15}}| shows as 1975-09-15 but {{#time:Y-m-d|1935-09-15}}| shows as 1935-09-15

However early dates can be wikified:

Hence [[1935-09-15]] shows as 1935-09-15

Hence where datestyle is defined, we need to trap dates before 1970. This is done by an initial test date styling and seeing if the outcome is 1970-01-01, in which case no formating is applied and the date is shown as unlinked free text:

{{User:Davidruben/sandbox2|title=Example|url=http://example.com/|publisher=Example Inc.|accessdate=1935-01-01|date=1935-01-01|datestyle=dmy}}

Generates: "Example". Example Inc. (1 January 1935). Retrieved on 1 January 1935.


Mis-formated dates

edit

Some examples of where dates wrongly formated or presented already partly wikilinked (datestyle set to "mdy" throughout). All result in some form of a date being shown (ie no "error" is seen to occur). In practice any date value that can not be formated (as is the case if already manually part wikilinked) is show directly as that parameter value (i.e. the wikilinked value itself). Hence in examples below "3rd February 2008" can be formated and so this is undertaken, but the template and parser functions do not reconginse say "[[20 May]] [[2007]]", "[[20 May]],[[2007]]" or "[[20 May]] of the year [[2007]]" and these are shown directly as entered. This show as-is if any sort of error is needed to cope with MediaWiki's bugs of not being able to handle dates before 1901.

Finally compare handling for a pre-1901 date:

  • date=[[20 May]] [[1884]] & datestyle=mdy not a date format and so shown as-is
    "Example". Example Inc. (20 May 1884).
  • but date=1884-05-20 & datestyle=mdy - cannot be formated as pre-1901
    "Example". Example Inc. (May 20, 1884).
  • but date=1884-05-20 & datestyle blank (i.e. forcing wikified dates)
    "Example". Example Inc. (1884-05-20).

Part dates and free text

edit
Current {{cite web |title=Title |url=http://example.org |date=2007-10-16 |accessdate=2008-07-20}}
Gives: "Title". 2007-10-16. Retrieved 2008-07-20.
and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=2007-10-16 |accessdate=2008-07-20}}
for: "Title" (2007-10-16). Retrieved on 2008-07-20. - nolonger link true ISO dates after 1970
Part date{{cite web |title=Title |url=http://example.org |date=August 2007 |accessdate=July 2008 }}
Gives: "Title". August 2007. Retrieved July 2008. {{cite web}}: Check date values in: |accessdate= (help)
and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=August 2007 |accessdate=July 2008 |datestyle=}}
for: "Title" (August 2007). Retrieved on July 2008.
Just year{{cite web |title=Title |url=http://example.org |date=2007 |accessdate=2008}}
Gives: "Title". 2007. Retrieved 2008. {{cite web}}: Check date values in: |accessdate= (help)
and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=2007 |accessdate=2008}}
for: "Title" (2007). Retrieved on 2008.
Free text{{cite web |title=Title |url=http://example.org |date=pre 2007 |accessdate=last week}}
Gives: "Title". pre 2007. Retrieved last week. {{cite web}}: Check date values in: |accessdate= and |date= (help)
and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=pre 2007 |accessdate=last week}}
for: "Title" (pre 2007). Retrieved on last week.
Ok so that is where the new proposal overlinked (valid) values for "date" and redlinked invalid date formats (something that seemed a useful feature, except "undated" was not considered as a possible valid value). But if the approach was to be extended to {{cite book}}, then issue of coping with pre-1970 & pre-1901 dates:
Pre 1970:{{cite web |title=Title |url=http://example.org |date=1960-01-27 |accessdate=1965-05-16}}
Gives: "Title". 1960-01-27. Retrieved 1965-05-16. {{cite web}}: Check date values in: |accessdate= (help)
and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=1960-01-27 |accessdate=1965-05-16|datestyle=}}
for: "Title" (1960-01-27). Retrieved on 1965-05-16.
But pre-1901:{{cite web |title=Title |url=http://example.org |date=1860-01-27 |accessdate=1965-05-16}}
Gives: "Title". 1860-01-27. Retrieved 1965-05-16. {{cite web}}: Check date values in: |accessdate= (help)
and {{User:Davidruben/sandbox2|title=Title |url=http://example.org |date=1860-01-27 |accessdate=1965-05-16|datestyle=}}
for: "Title" (1860-01-27). Retrieved on 1965-05-16.