User:Davidruben/sandbox7

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

Usage
THIS IS A SANDBOX TEST for update to Date style, see its intended documentation Template:Date style/doc

none
Generates:

Current coding error
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 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
Generates:

DMY
Generates:

MDY
Generates:

YMD
Generates:

Pre 1970 issue
Because Unix cannot handle dates before 1970, these can not be converted into date styles by the wikipedia parserfunction function:
 * Hence | shows as but | shows as

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:

Generates:

Mis-formated dates
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.


 * date= 20 May 2007
 * date= 20 May 2007
 * date= May 20 2007
 * date= 3rd February 2008
 * date= 20 May 1968
 * date= 2007-04-13

Finally compare handling for a pre-1901 date:
 * date= 20 May 1884 & datestyle=mdy not a date format and so shown as-is
 * but date= 1884-05-20 & datestyle=mdy - cannot be formated as pre-1901
 * but date= 1884-05-20 & datestyle blank (i.e. forcing wikified dates)

Part dates and free text

 * Current
 * Gives:
 * and
 * for:
 * Part date
 * Gives:
 * and
 * for:
 * Just year
 * Gives:
 * and
 * for:
 * Free text
 * Gives:
 * and
 * for:


 * 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:
 * Gives:
 * and
 * for:
 * But pre-1901:
 * Gives:
 * and
 * for:

.