Changes
→Usage: update
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
== Usage ==
{{Tlx|YEAR|{{var|string formatted as a valid date}}}}
{{YEAR/demo|1999}}
{{YEAR/demo|1999-12-12}}
{{YEAR/demo|January 1999}}
{{YEAR/demo|1 January 1999}}
{{YEAR/demo|January 1, 1999}}
{{YEAR/demo|1-2-1990}}
{{YEAR/demo|1/2/1990}}
{{YEAR/demo|2239-10-23}}
Reports "Error" if given bad input:
{{YEAR/demo|1-14-1990}}<br />{{in5}}Reason for the error: there are not 14 months.
{{YEAR/demo|61 January 1999}}<br />{{in5}}Reason for the error: no month has 61 days.
{{YEAR/demo|1 MyMonth 1999}}<br />{{in5}}Reason for the error: there is no such month name.
{{YEAR/demo|some text which is not a date}}<br />{{in5}}Reason for the error: no date information to parse.
{{YEAR/demo|on approximately 1999-12-12}}<br />{{in5}}Reason for the error: includes extraneous content.
If used with a year range, it returns only the first match:
* {{YEAR/demo|1999-2001}}
This presently only works when the year range is specified with a hyphen; if correctly given with an en dash, it reports an error (this will probably not be fixed, because handling ranges is not the template's function; that it kinda-sorta works on something like <code>1999-2001</code> with a hyphen is basically just an accident):
* {{YEAR/demo|1999–2001}}
If used without input, it simply outputs the current year:
*{{YEAR/demo|}}
It can be cleanly [[WP:SUBST|substituted]] for this purpose. If fed invalid data when substituted, it produces a larger, red error.
== See also ==
* {{tlx|date}} – outputs the current date in various parameter-controlled formats
* {{tlx|DATE}} – a subst-only convenience template used inside cleanup/dispute templates; <code><nowiki>|{{subst:DATE}}</nowiki></code> produces: <code>{{!}}date=December 2018</code>
* [[:Category:Time, date and calendar templates]] – numerous date computing, formatting, annotating, and navigation templates
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Date-computing templates]]
</includeonly>
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
== Usage ==
{{Tlx|YEAR|{{var|string formatted as a valid date}}}}
{{YEAR/demo|1999}}
{{YEAR/demo|1999-12-12}}
{{YEAR/demo|January 1999}}
{{YEAR/demo|1 January 1999}}
{{YEAR/demo|January 1, 1999}}
{{YEAR/demo|1-2-1990}}
{{YEAR/demo|1/2/1990}}
{{YEAR/demo|2239-10-23}}
Reports "Error" if given bad input:
{{YEAR/demo|1-14-1990}}<br />{{in5}}Reason for the error: there are not 14 months.
{{YEAR/demo|61 January 1999}}<br />{{in5}}Reason for the error: no month has 61 days.
{{YEAR/demo|1 MyMonth 1999}}<br />{{in5}}Reason for the error: there is no such month name.
{{YEAR/demo|some text which is not a date}}<br />{{in5}}Reason for the error: no date information to parse.
{{YEAR/demo|on approximately 1999-12-12}}<br />{{in5}}Reason for the error: includes extraneous content.
If used with a year range, it returns only the first match:
* {{YEAR/demo|1999-2001}}
This presently only works when the year range is specified with a hyphen; if correctly given with an en dash, it reports an error (this will probably not be fixed, because handling ranges is not the template's function; that it kinda-sorta works on something like <code>1999-2001</code> with a hyphen is basically just an accident):
* {{YEAR/demo|1999–2001}}
If used without input, it simply outputs the current year:
*{{YEAR/demo|}}
It can be cleanly [[WP:SUBST|substituted]] for this purpose. If fed invalid data when substituted, it produces a larger, red error.
== See also ==
* {{tlx|date}} – outputs the current date in various parameter-controlled formats
* {{tlx|DATE}} – a subst-only convenience template used inside cleanup/dispute templates; <code><nowiki>|{{subst:DATE}}</nowiki></code> produces: <code>{{!}}date=December 2018</code>
* [[:Category:Time, date and calendar templates]] – numerous date computing, formatting, annotating, and navigation templates
<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Date-computing templates]]
</includeonly>