Template:Year/doc

New code: more time formats accepted
If last "word" is 4 digits then just use that.

→ 2019 → 2019 → 2019

Usage
-

1998 - 1998

1999 - 1999

1999 - 1999

1999 - 1999

1999 - 1999

1990 - 1990

1990 - 1990

2239 - 2239

2019 2019 2019 2019

2019 2019 Reports "Error" without a reason if given bad input:

1990 1990 Reason for the error: there are not 14 months. Reason for the error: no month has 61 days. Reason for the error: there is no such month name. Reason for the error: no date information to parse.

If used with a year range, it returns only the first match:

This presently only works when the year range is specified with a hyphen -; if correctly given with an en dash -; which looks very similar, it reports an error (handling ranges is not the template's function).

If used without input, it simply outputs the current year:



It can be cleanly substituted for this purpose. If fed invalid data when substituted, it produces a larger, red error.

If used when the value is already a year rather than a full date, it simply outputs the year:


 * 2017 2017