Jump to content

Template:YMD to ISO/testcases

From Wikipedia, the free encyclopedia

Tests of main template (no sandbox)

[edit]

Used as input

[edit]

With the {{#time}} parser function:

  • {{#time: r|{{YMD to ISO|2000 January 17}}}} → Mon, 17 Jan 2000 00:00:00 +0000
  • without {{YMD to ISO}}: {{#time: r|2000 January 17}}Error: Invalid time.

With the {{Date}} template:

  • {{Date|{{YMD to ISO|2000 January 17}}|dmy}} → 17 January 2000
  • without {{YMD to ISO}}: {{Date|2000 January 17|dmy}} → 2000 January 17 (not converted to dmy)

With the {{ISO date}} template:

  • {{ISO date|{{YMD to ISO|2000 January 17}}|dmy}}2000-01-17
  • without {{YMD to ISO}}: {{ISO date|2000 January 17|dmy}}Error: Invalid time.

Valid YMD dates – Full month names

[edit]

(returns ISO date)

  • {{YMD to ISO| 2000_January_17 }} → 2000-01-17
  • {{YMD to ISO|2000 January 17}} → 2000-01-17
  • {{YMD to ISO|2000 February 29}} → 2000-02-29
  • {{YMD to ISO|1900 February 28}} → 1900-02-28
  • {{YMD to ISO|2000 March 17}} → 2000-03-17
  • {{YMD to ISO|2000 April 17}} → 2000-04-17
  • {{YMD to ISO|2000 May 17}} → 2000-05-17
  • {{YMD to ISO|2000 June 17}} → 2000-06-17
  • {{YMD to ISO|2000 July 17}} → 2000-07-17
  • {{YMD to ISO|2000 August 17}} → 2000-08-17
  • {{YMD to ISO|2000 September 17}} → 2000-09-17
  • {{YMD to ISO|2000 October 17}} → 2000-10-17
  • {{YMD to ISO|2000 November 17}} → 2000-11-17
  • {{YMD to ISO|2000 December 17}} → 2000-12-17
  • {{YMD to ISO|2000 december 17}} → 2000-12-17
  • {{YMD to ISO|2000 DECEMBER 17}} → 2000-12-17

Valid YMD dates – Abbreviated month names

[edit]

(returns ISO date)

  • {{YMD to ISO|2000 Jan 1}} → 2000-01-01
  • {{YMD to ISO|2000 Feb 1}} → 2000-02-01
  • {{YMD to ISO|2000 Mar 1}} → 2000-03-01
  • {{YMD to ISO|2000 Apr 1}} → 2000-04-01
  • {{YMD to ISO|2000 May 1}} → 2000-05-01
  • {{YMD to ISO|2000 Jun 1}} → 2000-06-01
  • {{YMD to ISO|2000 Jul 1}} → 2000-07-01
  • {{YMD to ISO|2000 Aug 1}} → 2000-08-01
  • {{YMD to ISO|2000 Sep 1}} → 2000-09-01
  • {{YMD to ISO|2000 Sept 1}} → 2000-09-01
  • {{YMD to ISO|2000 Sept. 1}} → 2000-09-01
  • {{YMD to ISO|2000 Oct 1}} → 2000-10-01
  • {{YMD to ISO|2000 Nov 1}} → 2000-11-01
  • {{YMD to ISO|2000 Dec 1}} → 2000-12-01
  • {{YMD to ISO|2000 dec 1}} → 2000-12-01
  • {{YMD to ISO|2000 DEC. 1}} → 2000-12-01

Invalid month

[edit]

(returns original input)

  • {{YMD to ISO|2000 Janet 17}} → 2000 Janet 17
  • {{YMD to ISO|2000 abc 11}} → 2000 abc 11
  • {{YMD to ISO|2000 abc. 11}} → 2000 abc. 11
  • {{YMD to ISO|2000 abcdefghi 11}} → 2000 abcdefghi 11

Invalid day of month

[edit]

(returns original input)

  • {{YMD to ISO|2000 January 00}} → 2000 January 00
  • {{YMD to ISO|2000 January 32}} → 2000 January 32
  • {{YMD to ISO|2000 February 30}} → 2000 February 30
  • {{YMD to ISO|1900 February 29}} → 1900 February 29

Invalid pattern – No input

[edit]

(returns empty string)

  • {{YMD to ISO}}
  • {{YMD to ISO|}}
  • {{YMD to ISO| }}

Invalid pattern – Invalid date

[edit]

(returns original input)

  • {{YMD to ISO|2000 Dec 117}} → 2000 Dec 117
  • {{YMD to ISO|200 Dec 17}} → 200 Dec 17
  • {{YMD to ISO|2000 De 17}} → 2000 De 17
  • {{YMD to ISO|2000 Septemberrr 17}} → 2000 Septemberrr 17

Invalid pattern – Non-YMD date

[edit]

(returns original input)

  • {{YMD to ISO|1 Dec 2000}} → 1 Dec 2000
  • {{YMD to ISO|17 December 2000}} → 17 December 2000
  • {{YMD to ISO|Dec 1, 2000}} → Dec 1, 2000
  • {{YMD to ISO|Dec. 1, 2000}} → Dec. 1, 2000
  • {{YMD to ISO|December 17, 2000}} → December 17, 2000
  • {{YMD to ISO|2000-12-17}} → 2000-12-17