Template:ISOyear/doc

Extracts year from calendar dates in ISO 8601 extended format (YYYY-MM-DD, e.g. "2025-08-05"). This template is very similar to {{#time: Y}} parser function , but accepts a year as input, even in cases where #time would interpret that as a time. In the case of wrong input template does not return anything.

Usage

{{ISOyear|1=}}

Parameters

Parameter name Description Default value required or optional?

parameter #1 (1) date in ISO 8601 format. Supported formats: YYYY-MM-DD, YYYY-MM, YYYY. Other formats not officially supported but returning correct results include: single digit months and days and years without months or days can have any number of digits. Supported dates are any proleptic Gregorian calendar or Gregorian calendar dates between 1 January 0001 AD and 31 December 9999 AD. empty required

Additional information

The template is intended to be used in the following namespaces: all namespaces

The template is intended to be used by the following user groups: all users

Relies on:
Module:Date

See also

{{ISOdate}}

Testing

More tests can be found at Template:ISOyear/testcases.

YYYY-MM-DD tests:

  1. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  2. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  3. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  4. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  5. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  6. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  7. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  8. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  9. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  10. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  11. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  12. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  13. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  14. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  15. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."

YYYY-MM tests:

  1. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  2. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  3. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  4. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  5. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  6. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  7. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  8. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  9. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  10. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  11. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  12. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  13. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."

YYYY tests:

  1. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  2. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  3. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  4. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  5. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  6. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  7. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  8. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  9. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  10. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."

0ther:

  1. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."
  2. {{ISOyear{{{3}}}{{{4}}}{{{5}}}{{{6}}}{{{7}}}{{{8}}}{{{9}}}{{{10}}}{{{11}}}...}} gives "Lua error in Module:Date at line 46: attempt to call local 'date' (a table value)."