Jump to content

Template:Time interval/testcases

From Wikipedia, the free encyclopedia

Classic test cases

[edit]
Code Display
Notes Expected Rendered Sandbox
{{time interval | 1958-06-07 | 2016-04-21 }} 57 years 57 years, 10 months and 14 days 57 years, 10 months and 14 days
Most generic form, can be used for a person's age, time between events, lengths of eras, etc.
{{time interval | 1961 | 1989 }} 28 years 28 years 28 years
Lower precision input works too
{{time interval | 1999-08-17 }} 25 years 25 years, 3 months and 4 days 25 years, 3 months and 4 days
Second date omitted, defaults to now
{{time interval | 17 August 1999 }} 25 years 25 years, 3 months and 4 days 25 years, 3 months and 4 days
Also accept spelled-out date formats
{{time interval | August 17, 1999 | disp=raw }} 25 25 3 4 25 3 4
No units, display years elapsed as number only
{{time interval | 1958-06-07 | 2016-04-21 | disp=age }} 57 years old 57 years 57 years
Traditional age display
{{time interval | 1794-06-08 | 1795-03-16 }} 9 months 8 days 9 months and 8 days 9 months and 8 days
Defaulting to {{age_for_infant}} precision for intervals under 3 years
{{time interval | 2016-04-08 20:43 | 2016-05-11 18:31 }} 32 days 21 hours 48 minutes 1 month and 2 days 1 month and 2 days
Precise duration
{{time interval | 2016-04-08 20:43 | 2016-05-11 18:31 | abbr=on }} 32d 21h 48m 1m 2d 1 m 2 d
Abbreviate units
{{time interval | 2016-04-08 20:43 | 2016-05-11 18:31 | round=hours }} 32 days 22 hours 1 month, 2 days and 22 hours 1 month, 2 days and 22 hours
Round to closest hour
{{time interval | 2016-04-08 20:43 | 2016-05-11 18:31 | round=days }} 33 days 1 month and 3 days 1 month and 3 days
Round to closest day
{{time interval | 28 July 1914 | 11 November 1918 | round=weeks }} 4 years, 3 months and 2 weeks 4 years, 3 months and 2 weeks 4 years, 3 months and 2 weeks
Replacing {{age in years, months, weeks and days}} (example from World War I)
{{time interval | 13 June 2001 | 14 July 2002 | round=days }} 1 year, 1 month and 1 day 1 year, 1 month and 1 day 1 year, 1 month and 1 day
No plural on one day, month or year