Changes

Jump to navigation Jump to search
→‎Examples: Fixed grammar
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
{{subst only|auto=yes}}

== Usage ==
{{tl|Show by}} is a wrapper for {{tl|Show by date}} that will automatically display one of two statements based on whether a particular date/time has been reached.

{{tlsx|Show by|''date/time''|''text before''|''text after''|demo{{=}}}}

*Parameter 1 (<code>''date/time''</code>) is the date and/or time that the template should show the <code>''text after''</code>. Until that date and time, the <code>''text before''</code> is shown. The <code>''date/time''</code> parameter can be in any format accepted by PHP's [http://www.php.net/manual/en/function.strtotime.php strtotime()] function. See [[:mw:Help:Extension:ParserFunctions#.23time]] for more information.
*Parameter 2 (<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 3 (<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 demo parameter (<code>demo=yes</code>) can be used to prevent automatic substitution of the template.

This template should always be substituted ({{tls|Show by}}). This will insert the {{tl|Show by date}} template using separate parameters for year, month, date, and time.

The {{tl| show by date}} template inserted by this template is particularly useful on low-activity articles where dated statements may not receive prompt attention. A [[WP:BOT]], [[User:AnomieBOT]], will substitute the {{tl|Show by date}} 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}}+2}}" to "Mr. Smith took office on 1 January {{#expr:{{CURRENTYEAR}}+2}}" 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}}+2}}" does not usually support a statement "The movie was released on 1 January {{#expr:{{CURRENTYEAR}}+2}}" since movie dates often slip; on the other hand, it could support "The movie was scheduled for release on 1 January {{#expr:{{CURRENTYEAR}}+2}}" 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.
* This template supports both absolute (e.g. <code>20 December 2000</code>) and relative (e.g. <code>+20 hours</code>) times, but relative times should only be used if the template is manually substituted. If the template is bot substituted, the time will be relative to the time that the bot edited the page.

===Limitations===
* Unless <code>''date/time''</code> specifies a time zone, 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).
* 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 (see example below).
* 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>{{subst:show by|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|</nowiki>Show this before {{#expr:{{CURRENTYEAR}}+2}}<nowiki>|</nowiki>Show this after {{#expr:{{CURRENTYEAR}}+2}}}} has started
|{{show by|{{#expr:{{CURRENTYEAR}}+2}}|Show this before {{#expr:{{CURRENTYEAR}}+2}}|Show this after {{#expr:{{CURRENTYEAR}}+2}}|demo=yes}} has started
|-
|<nowiki>{{subst:show by|</nowiki>{{CURRENTYEAR}}<nowiki>|</nowiki>Show this before {{CURRENTYEAR}}<nowiki>|</nowiki>Show this after {{CURRENTYEAR}}}} has started
|{{show by|{{CURRENTYEAR}}|Show this before {{CURRENTYEAR}}|Show this after {{CURRENTYEAR}}|demo=yes}} has started
|-
|<nowiki>{{subst:show by|September </nowiki>{{#expr:{{CURRENTYEAR}}-2}}<nowiki>|Show this before September </nowiki>{{#expr:{{CURRENTYEAR}}-2}}<nowiki>|</nowiki>Show this after September {{#expr:{{CURRENTYEAR}}-2}}}} has started
|{{show by|September {{#expr:{{CURRENTYEAR}}-2}}|Show this before September {{#expr:{{CURRENTYEAR}}-2}}|Show this after September {{#expr:{{CURRENTYEAR}}-2}}|demo=yes}} has started
|-
|<nowiki>{{subst:show by|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}-09-06<nowiki>|</nowiki>Show this before {{#expr:{{CURRENTYEAR}}+2}}-09-06<nowiki>|</nowiki>Show this as of {{#expr:{{CURRENTYEAR}}+2}}-09-06}}
|{{show by|{{#expr:{{CURRENTYEAR}}+2}}-09-06|Show this before {{#expr:{{CURRENTYEAR}}+2}}-09-06|Show this as of {{#expr:{{CURRENTYEAR}}+2}}-09-06|demo=yes}}
|-
|<nowiki>{{subst:show by|</nowiki>{{#expr:{{CURRENTYEAR}}-2}}-09-06 12:00pm EST<nowiki>|</nowiki>Before noon Eastern Standard Time on {{#expr:{{CURRENTYEAR}}-2}} September 6<nowiki>|</nowiki>After noon Eastern Standard Time on {{#expr:{{CURRENTYEAR}}-2}} September 6}}
|{{show by|{{#expr:{{CURRENTYEAR}}-2}}-09-06 12:00pm EST|Bfore noon Eastern Standard Time on {{#expr:{{CURRENTYEAR}}-2}} September 6|After noon Eastern Standard Time on {{#expr:{{CURRENTYEAR}}-2}} September 6|demo=yes}}
|-
|<nowiki>{{subst:show by|06 Sep </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|Show this before 06 Sep </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|}}</nowiki>
|{{show by|06 Sep {{#expr:{{CURRENTYEAR}}+2}}|Show this before 06 Sep {{#expr:{{CURRENTYEAR}}+2}}||demo=yes}}
|-
|<nowiki>{{subst:show by|06 Sep </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>||Show this after 06 Sep </nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>}}</nowiki>
|{{show by|06 Sep {{#expr:{{CURRENTYEAR}}+2}}||Show this after 06 Sep {{#expr:{{CURRENTYEAR}}+2}}|demo=yes}}
|-
|<nowiki>{{subst:show by|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|{{subst:show by|</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|{{#expr:{{CURRENTYEAR}}+2}}|{{show by|{{#expr:{{CURRENTYEAR}}-2}}|Show this before {{#expr:{{CURRENTYEAR}}-2}}|Show this between {{#expr:{{CURRENTYEAR}}-2}} and {{#expr:{{CURRENTYEAR}}+2}}|demo=yes}}|Show this as of {{#expr:{{CURRENTYEAR}}+2}}|demo=yes}}
|-
|<nowiki>{{subst:show by| -1 day |It is before yesterday|It is after yesterday}}</nowiki>
|{{show by| -1 day |It is before yesterday|It is after yesterday|demo=yes}}
|-
|<nowiki>{{subst:show by| +1 day |It is before tomorrow|It is after tomorrow}}</nowiki>
|{{show by| +1 day |It is before tomorrow|It is after tomorrow|demo=yes}}
|-
|<nowiki>Note *{{subst:show by|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>| lost spacing }}*, and *{{subst:show by|</nowiki>{{#expr:{{CURRENTYEAR}}+2}}<nowiki>|&amp;#32;workaround&amp;#32;}}*</nowiki>
|Note *{{show by|{{#expr:{{CURRENTYEAR}}+2}}| lost spacing |demo=yes}}*, and *{{show by|{{#expr:{{CURRENTYEAR}}+2}}|&#32;workaround&#32;|demo=yes}}*
|}

===Related templates===
* {{tl|Show by date}} The template that this is a wrapper for, with separate parameters for 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 upate 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; interwikis at Wikidata -->
[[Category:Temporal templates]]
[[Category:Time and date maintenance templates]]
[[Category:Date-computing templates based on current time]]
}}</includeonly>
Anonymous user

Navigation menu