Wikipedia:Date formattings

Aim: to fix up all date references on Wikipedia so they conform to the encyclopedia's manual of style for dates.

Note that this is a moving target – every day, hundreds (if not thousands) of incorrectly formatted/linked dates come into being. However, we do have tools to help us.

Scope
Wikipedia's manual of style for dates and numbers encourages consistency in formats used. As there are two permissible date formats used in running text in Wikipedia, articles will belong to one or other category. Thousands of articles have a mix of dmy and mdy date formats which need to be unified into one format or another.

Many articles with linked dates require cleanup to remove the links and standardize the dates to a single format (either day month or month day, but not a mixture of both). It is the aim of this project, for future maintenance, to tag every article in mainspace as belonging to either "dmy" or "mdy". This tagging may be performed manually, or by scripts. The semi-automatic tools developed may also make date alignments to articles at the same time as putting non-displaying maintenance templates into articles.

Much of the donkey work of aligning date formats within the body of an article as well as the references sections can be performed using semi-automated tools.

Ongoing maintenance of date formats may one day be carried out by bots on articles already tagged with templates ( or ) which help to identify the correct format.

Potentially ambiguous dates, using slashes or full stops (6/7/1961, 12/07/1986, 6.7.1961, 12.07.1986) are re-appearing on some thousands of pages, despite being eradicated from the 'pedia a few years ago.

When running automated searches, beware rare false positives, for example:
 * The Long March 2 Rocket (Contains "March 2" which could be flagged as a date.)

Forms
Dates may exist in their 'full' form (i.e. September), or may be 'abbreviated' (i.e. shortened to three letters, such as 'Aug', or occasionally four, as in 'Sept'), with or without the trailing full stop. In many articles, there are a mixture of full and abbreviated forms.

Linking of dates and date fragments
Consensus is that full dates ('20 April 2011'), day month ('20 April') or month day ('April 20'), years (2011) months ('April') and days of week ('Tuesday') should, except for timeline articles, only rarely be linked as per MOS:UNLINKDATES. Month–year combinations, generally Month Year or Year Month should not be linked.

Note:
 * Most instances of "March NNN" are likely to be racing car designations, not date fragments.
 * May 1968 is a redirect to May 1968 events in France and should be piped or changed to link to its target.

There are a large number of articles with indiscriminate linking of years. These include:
 * Category:Lists of state leaders by year

Irregular task: choose a year, date, month or day of week, click "what links here" and remove any undesirable links. Note that links can be piped links, or using the cite web template accessdate=February (replace with accessmonthday=February).

Centuries
In many cases centuries have been given an illegitimate capital C. or a capital for the ordinal e.g. Eighteenth. Also sentences starting with a numeral should be changed where possible, either by using words or by re-casting. The Oxford style manual recommends using words throughout.

Also look out for Roman numerals, especially in articles translated from French.


 * Avoid changing case in titles of books or articles. (Except we convert all-caps titles as a matter of MoS anyway.)

Whitelists
We maintain provisional "whitelists" of articles which may have one or more valid links, please feel free to add new instances or remove any that are wrong.
 * Note a rough catch-all is Category: calendar(s) and Category:Days, Months and Weeks


 * /Whitelist January
 * /Whitelist February
 * /Whitelist March
 * /Whitelist April
 * /Whitelist May
 * /Whitelist June
 * /Whitelist July
 * /Whitelist August
 * /Whitelist September
 * /Whitelist October
 * /Whitelist November
 * /Whitelist December


 * /Whitelist Monday
 * /Whitelist Tuesday
 * /Whitelist Wednesday
 * /Whitelist Thursday
 * /Whitelist Friday
 * /Whitelist Saturday
 * /Whitelist Sunday


 * /Whitelist Month Year

Autoformatting templates
The community on the whole rejected the use of autoformatting. However, templates have been created which ostensibly work on "magic word" or other method to autoformat dates. Some are still in place: While the prevalence of the newer #dateformat is low, date is transcluded by thousands of articles and templates.
 * date
 * 16 December 2009

Some of the more common templates that also serve to allow date sorting or perform multiple formatting tasks.

Tools
Useful tools include:
 * The wiki itself:
 * What links here
 * Look for templates that format dates the wrong way. Fixing these can fix hundreds or thousands of pages at one go.

Scripts

 * Date.js from User:Plastikspork –
 * spork_cite_to_mdy: changes 'date = YYYY-MM-DD' to 'date = Month DD, YYYY'
 * spork_cite_to_dmy: changes 'date =YYYY-MM-DD' to 'date = DD Month YYYY'
 * spork_cite_to_yyyymmdd: changes 'date = Month DD, YYYY' or 'date = DD Month YYYY' to 'date = YYYY-MM-DD'
 * MOSNUM dates.js – a comprehensive tool maintained by User:Ohconfucius based on scripts written by User:Lightmouse which can help make all date formats (dmy and mdy) consistent, whilst removing common errors and ambiguous date formats; it removes any links to dates or date fragments.
 * Delinks all dates and date fragments, and converts them all to the same format, either dmy (20 April 2011) and mdy (April 20, 2011). Resolves unambiguous slash-dates (e.g. 7/7/1961, 23/07/1961, 07/23/61...). Optional functions:
 * all dates to dmy – making all dates uniformly dmy.
 * all dates to mdy – ditto, but making all dates uniformly mdy
 * US-slash dates – resolves US style slash-dates (e.g. 7/27/1961, 07/27/1961, 07/27/61, 7/27/61) into mdy format
 * UK-slash dates – resolves UK/European style slash-dates (e.g. 27/7/1961, 27/07/1961, 27/07/61, 27/7/61), or dates using the full stop as separator (e.g. 27.7.1961, 27.07.1961, 27.07.61, 27.7.61), into dmy format
 * DateFix.js from User:Dl2000 – a stripped down and evolved version of the tool originally written by User:Ohconfucius; functions and tags for several English variants. Not maintained since 2011.
 * DateFix.js from User:Dl2000 – a stripped down and evolved version of the tool originally written by User:Ohconfucius; functions and tags for several English variants. Not maintained since 2011.

AutoWikiBrowser
The AWB scripts below may be run as an imported module with the 'module' function of AWB. They are based on scripts originally written by Lightmouse, have the more basic functionalities of the scripts above. They strip out links of all dates and date fragments and also incorporate general style fixes.
 * User:Ohconfucius/AWB modules/dmy – module not maintained, and editors may use them at their own risk.
 * User:Ohconfucius/AWB modules/mdy – module not maintained, and editors may use them at their own risk.

Here is XML that solely unlinks "straight" links to days of week and months of year
 * JavaScript
 * For unlinking dates
 * For fixing xx/xx/xxxx dates

Potential false positives

 * Dates in citations. Note that, according to MOS:DATEUNIFY, dates in citations can be a different format from dates in the text as long as the citation date format is consistent and follows the rules in MOS:DATEUNIFY, even when a dates template specifies a specific article style. Automated date formatting tools generally do not account for this potential difference.
 * Direct quotes
 * Proper names (e.g. organisations, movements, book titles)
 * Names of images
 * Wikilinks (less of a problem – redirects can often be established)
 * URLs
 * Date ranges - when using automation, care must be taken with instances of date ranges such as '12–13 July', 'May 21–22', '12, 13, 14 and 15 July', or 'May 21, 22, 23 and 24; similarly, date ranges such as '12–13 July' ought not to be converted to '12–July 13'.
 * Also to note ranges may be separated by 'to', 'and', hyphens (-), endashes (–), emdashes (—), etc., and forms such as 17/18 January.
 * "the" is normally and properly removed before most dates (e.g. " the 12 December 1967"), but the article makes more sense to keep for certain phrases e.g. "... in the issue of Time", "... during the episode of Seinfeld." (usually involves reference to a periodical work)
 * Specialty abbreviations should not be confused with abbreviated months in limited cases:
 * "nov." (nova) in biology e.g. Strobilops sp. nov. 1 - the "nov. 1" portion should not be refactored into a November date
 * "dec." is sometimes used in cricket articles as short form for declaration and forfeiture - such cases should not be refactored to December

Finding pages
Use AWB on the following lists:


 * /Year 1800-1849
 * /Year 1850-1899
 * /Year 1900-1949
 * /Year 1950-1999
 * /Year 2000-2020
 * /Month Year
 * /Day Month
 * /Month Day

Dated cleanup categories

 * Category:Use dmy dates
 * Category:Use mdy dates