模板:Age in years and days/testcases

維基百科,自由的百科全書

測試 1

使用說明 模板使用 結果
兩日期之間 {{Age in years and days/sandbox|1989|7|23|2003|7|14|age=no}} 13年356天
兩日期之間 {{Age in years and days/sandbox|1989|7|23|2003|7|15|age=no}} 13年357天
兩日期之間 {{Age in years and days/sandbox|1989|7|23|2003|7|23|age=no}} 14年0天
兩日期之間 {{Age in years and days/sandbox|1989|7|23|2003|7|24|age=no}} 14年1天
從某一日期至今 {{Age in years and days/sandbox|1989|7|23|age=no}} 34年286天
不正確的日期 {{Age in years and days/sandbox|1980|7|14|1993|6|233}} 錯誤:第二個日期應該是年月日
(不正確的日期,計算的天數也就不正確了)
閏年的誤差 {{Age in years and days/sandbox|2007|2|28|2008|3|1}} 1歲2天
(多計算2008年2月29日這一天)
  • {{Age in years and days/sandbox|1995|5|11|1998|age=no}} -> 錯誤:第二個日期應該是年月日
  • {{Age in years and days/sandbox|1994|11|22|2000|1|1|age=no}} -> 5年40天
  • {{Age in years and days/sandbox|1994|11|22|2000|1|1|age=y}} -> 5歲40天
  • {{Age in years and days/sandbox|1994|11|22|2000|1|1}} -> 5歲40天

測試 2

date 1 date 2 Template:Age in years and days編輯 | 討論 | 歷史 | 連結 | 監視 | 日誌 Template:Age in years and days/sandbox編輯 | 討論 | 歷史 | 連結 | 監視 | 日誌
28 Feb 2002 1 Mar 2002 1天 1天
2002 02 28 2002 03 01 1天 1天
28 Feb 2004 1 Mar 2004 2天 2天
2004 02 28 2004 03 01 2天 2天
29 Feb 2004 1 Mar 2004 1天 1天
2004 02 29 2004 03 01 1天 1天
28 Feb 2002 1 Mar 2004 2歲2天 2歲2天
2002 02 28 2004 03 01 2歲2天 2歲2天
28 Feb 2004 1 Mar 2006 2歲1天 2歲1天
2004 02 28 2006 03 01 2歲1天 2歲1天
29 Feb 2004 1 Mar 2006 2歲1天 2歲1天
2004 02 29 2006 03 01 2歲1天 2歲1天
1 Mar 2002 28 Feb 2006 3歲364天 3歲364天
2002 03 01 2006 02 28 3歲364天 3歲364天
1 Mar 2002 28 Feb 2004 1歲364天 1歲364天
2002 03 01 2004 02 28 1歲364天 1歲364天
1 Mar 2002 29 Feb 2004 1歲365天 1歲365天
2002 03 01 2004 02 29 1歲365天 1歲365天
1 Mar 2004 28 Feb 2006 1歲364天 1歲364天
2004 03 01 2006 02 28 1歲364天 1歲364天
1 Mar 2004 28 Feb 2008 3歲364天 3歲364天
2004 03 01 2008 02 28 3歲364天 3歲364天
1 Mar 2004 29 Feb 2008 3歲365天 3歲365天
2004 03 01 2008 02 29 3歲365天 3歲365天
1 Mar 2004 28 Feb 2002 −2歲2天 −2歲2天
2004 03 01 2002 02 28 −2歲2天 −2歲2天
1 Jan 2002 18 Feb 2002 48天 48天
2002 01 01 2002 02 18 48天 48天
1 Jan 2002 18 Feb 2004 2歲48天 2歲48天
2002 01 01 2004 02 18 2歲48天 2歲48天
1 Jan 2004 18 Feb 2004 48天 48天
2004 01 01 2004 02 18 48天 48天
1 Jan 2004 18 Feb 2006 2歲48天 2歲48天
2004 01 01 2006 02 18 2歲48天 2歲48天
1 Oct 2002 18 Nov 2002 48天 48天
2002 10 01 2002 11 18 48天 48天
1 Oct 2002 18 Nov 2004 2歲48天 2歲48天
2002 10 01 2004 11 18 2歲48天 2歲48天
1 Oct 2004 18 Nov 2004 48天 48天
2004 10 01 2004 11 18 48天 48天
1 Oct 2004 18 Nov 2006 2歲48天 2歲48天
2004 10 01 2006 11 18 2歲48天 2歲48天
1 Aug 2002 18 May 2003 290天 290天
2002 08 01 2003 05 18 290天 290天
1 Aug 2002 18 May 2005 2歲290天 2歲290天
2002 08 01 2005 05 18 2歲290天 2歲290天
1 Aug 2004 18 May 2005 290天 290天
2004 08 01 2005 05 18 290天 290天
1 Aug 2004 18 May 2007 2歲290天 2歲290天
2004 08 01 2007 05 18 2歲290天 2歲290天
20 May 1901 30 Oct 1907 6歲163天 6歲163天
1901 05 20 1907 10 30 6歲163天 6歲163天
30 Oct 1907 27 Oct 1915 7歲362天 7歲362天
1907 10 30 1915 10 27 7歲362天 7歲362天
27 Oct 1915 14 Nov 1916 1歲18天 1歲18天
1915 10 27 1916 11 14 1歲18天 1歲18天
14 Nov 1916 10 Jan 1922 5歲57天 5歲57天
1916 11 14 1922 01 10 5歲57天 5歲57天
16 May 1922 29 Mar 1928 5歲318天 5歲318天
1922 05 16 1928 03 29 5歲318天 5歲318天
26 May 1928 1 Oct 1935 7歲128天 7歲128天
1928 05 26 1935 10 01 7歲128天 7歲128天
1 Oct 1935 5 Jul 1945 9歲277天 9歲277天
1935 10 01 1945 07 05 9歲277天 9歲277天
13 Jul 1945 13 Jun 1951 5歲335天 5歲335天
1945 07 13 1951 06 13 5歲335天 5歲335天
13 Jun 1951 9 Feb 1960 8歲241天 8歲241天
1951 06 13 1960 02 09 8歲241天 8歲241天
7 Mar 1960 8 Feb 1967 6歲338天 6歲338天
1960 03 07 1967 02 08 6歲338天 6歲338天
9 Feb 1967 22 Dec 1977 10歲316天 10歲316天
1967 02 09 1977 12 22 10歲316天 10歲316天
22 Dec 1977 3 Feb 1983 5歲43天 5歲43天
1977 12 22 1983 02 03 5歲43天 5歲43天
3 Feb 1983 20 Dec 1991 8歲320天 8歲320天
1983 02 03 1991 12 20 8歲320天 8歲320天
20 Dec 1991 11 Mar 1996 4歲82天 4歲82天
1991 12 20 1996 03 11 4歲82天 4歲82天
19 Mar 1996 22 Nov 2001 5歲248天 5歲248天
1996 03 19 2001 11 22 5歲248天 5歲248天
22 Nov 2001 2 Dec 2003 2歲10天 2歲10天
2001 11 22 2003 12 02 2歲10天 2歲10天
2 Dec 2003 28 Jan 2005 1歲57天 1歲57天
2003 12 02 2005 01 28 1歲57天 1歲57天
28 Jan 2005 4 Dec 2006 1歲310天 1歲310天
2005 01 28 2006 12 04 1歲310天 1歲310天
4 Dec 2006 24 Jun 2010 3歲202天 3歲202天
2006 12 04 2010 06 24 3歲202天 3歲202天
24 Jun 2010 26 Jun 2013 3歲2天 3歲2天
2010 06 24 2013 06 26 3歲2天 3歲2天
26 Jun 2013 13 Sep 2013 79天 79天
2013 06 26 2013 09 13 79天 79天
13 Oct 2013 10歲204天 10歲204天
2013 10 13 10歲204天 10歲204天
0天 0天
0天 0天

測試 3

主模板 沙盒模板

Two fixed dates: 1歲29天
Fixed date-today: 19歲93天

  • Leap year test

No leap year (1900): 1天
No leap year (1901): 1天
Yes leap year (1904): 2天

  • Single-plural test

Single year and day: 1歲1天
Plural year and day: 2歲2天
Single year and day over a leap day: 1歲1天
Plural year and day over a leap day: 2歲2天
Single year and day over new years: 1歲1天
Plural year and day over new years: 2歲2天

Two fixed dates: 1歲29天
Fixed date-today: 19歲93天

  • Leap year test

No leap year (1900): 1天
No leap year (1901): 1天
Yes leap year (1904): 2天

  • Single-plural test

Single year and day: 1歲1天
Plural year and day: 2歲2天
Single year and day over a leap day: 1歲1天
Plural year and day over a leap day: 2歲2天
Single year and day over new years: 1歲1天
Plural year and day over new years: 2歲2天