Jump to content

Template:Date/testcases

From Wikipedia, the free encyclopedia

Sandbox vs live

[edit]

With acceptable input

[edit]
Input Output Sandbox
No format specified
{{date|2006-05-04}} 4 May 2006 4 May 2006

(update)

{{date|May 4, 2006}} 4 May 2006 4 May 2006

(update)

{{date|4 May 2006}} 4 May 2006 4 May 2006

(update)

{{date|4 May}} 4 May 4 May

(update)

{{date|May 4}} 4 May 4 May

(update)

dmy format
{{date|2006-05-04|dmy}} 4 May 2006 4 May 2006

(update)

{{date|May 4, 2006|dmy}} 4 May 2006 4 May 2006

(update)

{{date|4 May 2006|dmy}} 4 May 2006 4 May 2006

(update)

{{date|4 May|dmy}} 4 May 4 May

(update)

{{date|May 4|dmy}} 4 May 4 May

(update)

mdy format
{{date|2006-05-04|mdy}} May 4, 2006 May 4, 2006

(update)

{{date|May 4, 2006|mdy}} May 4, 2006 May 4, 2006

(update)

{{date|4 May 2006|mdy}} May 4, 2006 May 4, 2006

(update)

{{date|4 May|mdy}} May 4 May 4

(update)

{{date|May 4|mdy}} May 4 May 4

(update)

ymd format
{{date|2006-05-04|ymd}} 2006 May 4 2006 May 4

(update)

{{date|May 4, 2006|ymd}} 2006 May 4 2006 May 4

(update)

{{date|4 May 2006|ymd}} 2006 May 4 2006 May 4

(update)

{{date|4 May|ymd}} May 4 May 4

(update)

{{date|May 4|ymd}} May 4 May 4

(update)

iso format
{{date|2006-05-04|iso}} 2006-05-04 2006-05-04

(update)

{{date|May 4, 2006|iso}} 2006-05-04 2006-05-04

(update)

{{date|4 May 2006|iso}} 2006-05-04 2006-05-04

(update)

{{date|4 May|iso}} May 4 May 4

(update)

{{date|May 4|iso}} May 4 May 4

(update)

none format
{{date|2006-05-04|none}} 2006-05-04 2006-05-04

(update)

{{date|May 4, 2006|none}} May 4, 2006 May 4, 2006

(update)

{{date|4 May 2006|none}} 4 May 2006 4 May 2006

(update)

{{date|4 May|none}} 4 May 4 May

(update)

{{date|May 4|none}} May 4 May 4

(update)

Other valid input

[edit]

A wide variety of other input formats are handled correctly by the template:

Input Output Sandbox
{{date|1st December 2008}}
(ordinal 'st')
1 December 2008 1 December 2008

(update)

{{date|June 24 2006}}
(missing comma)
24 June 2006 24 June 2006

(update)

{{date|24 june 2006}}
(lowercase month name)
24 June 2006 24 June 2006

(update)

{{date|24 jun}}
(abbreviated month name)
24 June 24 June

(update)

{{date|june 2006}} June 2006 June 2006

(update)

Invalid input

[edit]

Input strings that the template cannot format are returned unaltered. This includes strings containing characters such as square brackets, so any links will result in unformatted output.

Input Output Sandbox
{{date|23007-031-24}} 23007-031-24 23007-031-24

(update)

{{date|[[1 December]] [[2008]]|ymd}} 1 December 2008 1 December 2008

(update)

{{date|1 December [[2008 in film|2008]]|mdy}} 1 December 2008 1 December 2008

(update)

{{date|2008 December 1}}
(expected output: 1 December 2008)
2008 December 1 2008 December 1

(update)

{{date|2008 December 1|dmy}}
(expected output: 1 December 2008)
2008 December 1 2008 December 1

(update)

{{date|2008 December 1|mdy}}
(expected output: December 1, 2008)
2008 December 1 2008 December 1

(update)

{{date|2008 December 1|iso}}
(expected output: 2008-12-01)
2008 December 1 2008 December 1

(update)

{{date|2008 December 1|none}} 2008 December 1 2008 December 1

(update)



Subst sandbox vs live

[edit]

With acceptable input

[edit]
Input Output Sandbox
No format specified
{{date|2006-05-04}} 4 May 2006 4 May 2006
{{date|May 4, 2006}} 4 May 2006 4 May 2006
{{date|4 May 2006}} 4 May 2006 4 May 2006
{{date|4 May}} 4 May 4 May
{{date|May 4}} 4 May 4 May
dmy format
{{date|2006-05-04|dmy}} 4 May 2006 4 May 2006
{{date|May 4, 2006|dmy}} 4 May 2006 4 May 2006
{{date|4 May 2006|dmy}} 4 May 2006 4 May 2006
{{date|4 May|dmy}} 4 May 4 May
{{date|May 4|dmy}} 4 May 4 May
mdy format
{{date|2006-05-04|mdy}} 4 May 2006 May 4, 2006
{{date|May 4, 2006|mdy}} 4 May 2006 May 4, 2006
{{date|4 May 2006|mdy}} 4 May 2006 May 4, 2006
{{date|4 May|mdy}} 4 May May 4
{{date|May 4|mdy}} 4 May May 4
ymd format
{{date|2006-05-04|ymd}} 4 May 2006 2006 May 4
{{date|May 4, 2006|ymd}} 4 May 2006 2006 May 4
{{date|4 May 2006|ymd}} 4 May 2006 2006 May 4
{{date|4 May|ymd}} 4 May May 4
{{date|May 4|ymd}} 4 May May 4
iso format
{{date|2006-05-04|iso}} 4 May 2006 2006-05-04
{{date|May 4, 2006|iso}} 4 May 2006 2006-05-04
{{date|4 May 2006|iso}} 4 May 2006 2006-05-04
{{date|4 May|iso}} 4 May May 4
{{date|May 4|iso}} 4 May May 4
none format
{{date|2006-05-04|none}} 4 May 2006 2006-05-04
{{date|May 4, 2006|none}} 4 May 2006 May 4, 2006
{{date|4 May 2006|none}} 4 May 2006 4 May 2006
{{date|4 May|none}} 4 May 4 May
{{date|May 4|none}} 4 May May 4

Other valid input

[edit]

A wide variety of other input formats are handled correctly by the template:

Input Output Sandbox
{{date|1st December 2008}}
(ordinal 'st')
1 December 2008 1 December 2008
{{date|June 24 2006}}
(missing comma)
24 June 2006 24 June 2006
{{date|24 june 2006}}
(lowercase month name)
24 June 2006 24 June 2006
{{date|24 jun}}
(abbreviated month name)
24 June 24 June
{{date|june 2006}} June 2006 June 2006

Invalid input

[edit]

Input strings that the template cannot format are returned unaltered. This includes strings containing characters such as square brackets, so any links will result in unformatted output.

Input Output Sandbox
{{date|23007-031-24}} 23007-031-24 23007-031-24
{{date|[[1 December]] [[2008]]|ymd}} 1 December 2008 1 December 2008
{{date|1 December [[2008 in film|2008]]|mdy}} 1 December 2008 1 December 2008
{{date|2008 December 1}}
(expected output: 1 December 2008)
2008 December 1 2008 December 1
{{date|2008 December 1|dmy}}
(expected output: 1 December 2008)
2008 December 1 2008 December 1
{{date|2008 December 1|mdy}}
(expected output: December 1, 2008)
2008 December 1 2008 December 1
{{date|2008 December 1|iso}}
(expected output: 2008-12-01)
2008 December 1 2008 December 1
{{date|2008 December 1|none}} 2008 December 1 2008 December 1