Open main menu

Changes

no edit summary
{{Documentation subpage}}
{{for|the wrapper template that uses a freeform ''date/time'' parameter instead of separate ''year'', ''month'', and ''day'' parameters|Template:Show by}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->

===Usage===
This template will automatically display one of two statements based on whether a particular date has been reached or not.

{{tlx|show by date|''year''|''month''|''day''|''text before''|''text after''|hour{{=}}}}

*Parameters 1, 2, and 3 are the Year, Month, and Day that the template should show the '''text after'''. Until that date, the '''text before''' is shown. If the day is omitted, the template will activate on the first day of the specified month. If the month is also omitted, the template will activate on 1 January of the specified year. If the year is also omitted, the template will activate immediately.
*Parameter 4 (<code>''text before''</code>) is the text to be shown if the current date is before the date specified in the previous parameters; it may be left empty if only the <code>'''text after'''</code> needs to be displayed at the specified date
*Parameter 5 (<code>''text after''</code>) is the text to be shown if the current date is on or after the date specified in the previous parameters; it may be left empty if only the <code>'''text before'''</code> needs to be displayed until the specified date
*The hour parameter (<code>hour=</code>) is an optional parameter that sets the hour of the day in Wikipedia time ([[Coordinated Universal Time|UTC]]) that the template will begin showing the <code>''text after''</code>. If not specified, it defaults to 0 (midnight [[Coordinated Universal Time|UTC]]). When set to the offset between local time and UTC (for example -8 for [[Pacific Time Zone|Pacific Standard Time]]) it will cause the template to show <code>''text after''</code> at midnight local time.

The template is particularly useful on low-activity articles where dated statements may not receive prompt attention. A [[WP:BOT]], [[User:AnomieBOT]], will substitute the template with just the <code>'''text after'''</code> as the given dates elapse.

===Warnings===
* Be certain that the "before" and "after" versions of the statement are both reliably supported by the cited sources. For example, "Mr. Smith will take office on 1 January {{#expr:{{CURRENTYEAR}}+1}}" to "Mr. Smith took office on 1 January {{#expr:{{CURRENTYEAR}}+1}}" are both normally citable to the results of the election or announcement of the appointment. But the source for "The movie is scheduled for release on 1 January {{#expr:{{CURRENTYEAR}}+1}}" does not usually support a statement "The movie was released on 1 January {{#expr:{{CURRENTYEAR}}+1}}" since movie dates often slip; on the other hand, it could support "The movie was scheduled for release on 1 January {{#expr:{{CURRENTYEAR}}+1}}" or the template could be used to remove the text entirely, and {{tl|update after}} could be used to request an update.
* Be careful that the article does not contain awkward grammar before the date and will not contain awkward grammar when the "after" text is displayed.

===Limitations===
* Unless the <code>hour=</code> is set, statements will be switched on the date according to Wikipedia time (00:00 [[Coordinated Universal Time|UTC]]). If the actual event point is a few hours before or after this, it probably makes little difference in the grander scheme of time. However, it will make a significant difference if the actual event is more than 12 hours before or after this. For example, an event that takes place on {{CURRENTMONTHNAME}} {{CURRENTDAY}} at 8:00 pm [[Pacific Time Zone|Pacific Standard Time]] ([[UTC−08:00]]) corresponds to 04:00, ''{{tomorrow}}'' (UTC).<p>To work around this, set the <code>hour=</code> parameter to the offset between local time and UTC (for example -8 for [[Pacific Time Zone|Pacific Standard Time]]) or to the UTC time of the actual start of the event.</p>
* The output of this template will not be changed until the page is purged. MediaWiki may or may not manage to do this automatically. Category membership and the output of [[Special:WhatLinksHere]], if these are changed by the expiration of this template, will not be updated until the page is edited.
* Neither the <code>'''text before'''</code> nor the <code>'''text after'''</code> may begin or end with whitespace. Workarounds include using an escape code for space (<code>&amp;#32;</code>), using a non-breaking space (<code>&amp;nbsp;</code>), or including invisible markup (e.g. <code>&lt;nowiki/&gt;</code>) to prevent the spaces from being stripped.
* If the <code>'''text before'''</code> or <code>'''text after'''</code> contains an "=" or "|" character that is not inside another template invocation, use the templates {{tl|{{=}}}} or {{tl|!}}.

===Examples===
{| class="wikitable"
! Code !! Result
|-
|<nowiki>{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}<nowiki>|||</nowiki>Show this before {{#expr:{{CURRENTYEAR}}-2}}<nowiki>|</nowiki>Show this after {{#expr:{{CURRENTYEAR}}-2}}}} has started
|{{show by date|{{#expr:{{CURRENTYEAR}}-2}}|||Show this before {{#expr:{{CURRENTYEAR}}-2}}|Show this after {{#expr:{{CURRENTYEAR}}-2}}}} has started
|-
|<nowiki>{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|09||</nowiki>Show this before September {{#expr:{{CURRENTYEAR}}+2}}<nowiki>|</nowiki>Show this after September {{#expr:{{CURRENTYEAR}}+2}}}} has started
|{{show by date|{{#expr:{{CURRENTYEAR}}+2}}|09||Show this before September {{#expr:{{CURRENTYEAR}}+2}}|Show this after September {{#expr:{{CURRENTYEAR}}+2}}}} has started
|-
|<nowiki>{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}<nowiki>|09|06|</nowiki>Show this before 06 Sep {{#expr:{{CURRENTYEAR}}-2}}<nowiki>|</nowiki>Show this as of 06 Sep {{#expr:{{CURRENTYEAR}}-2}}}}
|{{show by date|{{#expr:{{CURRENTYEAR}}-2}}|09|06|Show this before 06 Sep {{#expr:{{CURRENTYEAR}}-2}}|Show this as of 06 Sep {{#expr:{{CURRENTYEAR}}-2}}}}
|-
|<nowiki>{{show by date|</nowiki>{{CURRENTYEAR}}<nowiki>|</nowiki>{{CURRENTMONTH}}<nowiki>|</nowiki>{{CURRENTDAY}}<nowiki>|</nowiki>Show this before {{#expr:{{CURRENTHOUR}}+2}}:00 UTC<nowiki>|</nowiki>Show this as of {{#expr:{{CURRENTHOUR}}+2}}:00 UTC<nowiki>|</nowiki>hour={{#expr:{{CURRENTHOUR}}+2}}}}
|{{show by date|{{CURRENTYEAR}}|{{CURRENTMONTH}}|{{CURRENTDAY}}|Show this before {{#expr:{{CURRENTHOUR}}+2}}:00 UTC|Show this as of {{#expr:{{CURRENTHOUR}}+2}}:00 UTC|hour={{#expr:{{CURRENTHOUR}}+2}}}}
|-
|<nowiki>{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|09|06|Show this before 06 Sep </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|}}</nowiki>
|{{show by date|{{#expr:{{CURRENTYEAR}}+2}}|09|06|Show this before 06 Sep {{#expr:{{CURRENTYEAR}}+2}}|}}
|-
|<nowiki>{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|09|06||Show this after 06 Sep </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>}}</nowiki>
|{{show by date|{{#expr:{{CURRENTYEAR}}+2}}|09|06||Show this after 06 Sep {{#expr:{{CURRENTYEAR}}+2}}}}
|-
|<nowiki>{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|||{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}<nowiki>|||Show this before </nowiki>{{#expr:{{CURRENTYEAR}}-2}}<nowiki>|Show this between </nowiki>{{#expr:{{CURRENTYEAR}}-2}} and {{#expr:{{CURRENTYEAR}}+2}}<nowiki>}}|Show this as of </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>}}</nowiki>
|{{show by date|{{#expr:{{CURRENTYEAR}}+2}}|||{{show by date|{{#expr:{{CURRENTYEAR}}-2}}|||Show this before {{#expr:{{CURRENTYEAR}}-2}}|Show this between {{#expr:{{CURRENTYEAR}}-2}} and {{#expr:{{CURRENTYEAR}}+2}}}}|Show this as of {{#expr:{{CURRENTYEAR}}+2}}}}
|-
|<nowiki>Note *{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>||| lost spacing }}*, and *{{show by date|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|||&amp;#32;workaround&amp;#32;}}*</nowiki>
|Note *{{show by date|{{#expr:{{CURRENTYEAR}}+2}}|01|01| lost spacing }}*, and *{{show by date|{{#expr:{{CURRENTYEAR}}+2}}|01|01|&#32;workaround&#32;}}*
|}

===Template data===
<templatedata>
{
"params": {
"1": {
"label": "year",
"required": true,
"suggested": true
},
"2": {
"label": "month",
"description": "Month number",
"suggested": true
},
"3": {
"label": "day",
"description": "Day of the month.",
"suggested": true
},
"4": {
"label": "Text before",
"description": "Text that will be shown before the specified date.",
"suggested": true
},
"5": {
"label": "Text after",
"description": "Text that will be shown on and after the specified date.",
"suggested": true
},
"hour": {
"label": "Hour",
"description": "Hour of the day in 24-hour UTC time"
}
},
"description": "This template will automatically display one of two statements based on whether a particular date has been reached or not.\n\n ##### param 1 is the year\n ##### param 2 is the month number\n ##### param 3 is the day of the month\n ##### param 4 is the text to show before the specified date\n ##### param 5 is the text to show on or after the specified date\n ##### hour is the hour of the day in 24-hour UTC time",
"format": "inline"
}
</templatedata>

===Related templates===
* {{tl|Show by}} A similar template that accepts a date/time string instead of separate parameters for the year, month, and day
* {{tl|As of}}
* {{tl|Update}}
** {{tlx|Update|inaccurate{{=}}y}} is used to mark an article whose factual accuracy may be compromised (although this may be disputed) due to out of date information. This template adds the article to [[:Category:Articles with obsolete information]].
* {{tl|Update after}}, which shows an inline update maintenance tag when a specified date is reached.

===See also===
* [[Wikipedia:Avoid statements that will date quickly]]

{{Inline tags}}

<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox |
| <!-- CATEGORIES BELOW THIS LINE, PLEASE: -->
[[Category:Temporal templates]]
[[Category:Time and date maintenance templates]]
[[Category:Date-computing templates based on current time]]
}}</includeonly>
Anonymous user