模板:Age in years and months/testcases
外觀
![]() | 這是Template:Age in years and months及其沙盒的測試樣例。刷新本頁以更新內容。 如果這裏有許多複雜的模板的用例,可能會因為MediaWiki的技術限制而出錯。 您還可以用Special:展開模板來測試模板的使用效果。 您可以通過以下連結測試本模板在不同外觀下的效果: |
測試 1
[編輯]{{Age in years and months|year1=2001|month1=1|day1=10|year2=2012|month2=2|day2=20}}
{{Age in years and months|year1=2001|month1=1|day1=10|year2=2012|month2=2|day2=20}}
→ 11年1個月{{Age in years and months/sandbox|year1=2001|month1=1|day1=10|year2=2012|month2=2|day2=20}}
→ 11年1個月
{{Age in years and months|year=2001|month=1|day=10|year2=2012|month2=2|day2=20}}
{{Age in years and months|year=2001|month=1|day=10|year2=2012|month2=2|day2=20}}
→ 11年1個月{{Age in years and months/sandbox|year=2001|month=1|day=10|year2=2012|month2=2|day2=20}}
→ 11年1個月
{{Age in years and months|2001|1|10|2012|2|20}}
{{Age in years and months|2001|1|10|2012|2|20}}
→ 11年1個月{{Age in years and months/sandbox|2001|1|10|2012|2|20}}
→ 11年1個月
{{Age in years and months|2001-1-10|2012-2-20}}
{{Age in years and months|2001-1-10|2012-2-20}}
→ 11年1個月{{Age in years and months/sandbox|2001-1-10|2012-2-20}}
→ 11年1個月
{{Age in years and months|10 Jan 2001|20 Feb 2012}}
{{Age in years and months|10 Jan 2001|20 Feb 2012}}
→ 11年1個月{{Age in years and months/sandbox|10 Jan 2001|20 Feb 2012}}
→ 11年1個月
{{Age in years and months|January 10, 2001|Feb 20, 2012}}
{{Age in years and months|January 10, 2001|Feb 20, 2012}}
→ 11年1個月{{Age in years and months/sandbox|January 10, 2001|Feb 20, 2012}}
→ 11年1個月
測試 2
[編輯]If the first or second date is omitted, the current date is used.
{{Age in years and months|year2=2012|month2=2|day2=20}}
{{Age in years and months|year2=2012|month2=2|day2=20}}
→ −12年5個月{{Age in years and months/sandbox|year2=2012|month2=2|day2=20}}
→ −12年5個月
{{Age in years and months||||2012|2|20}}
{{Age in years and months||||2012|2|20}}
→ −12年5個月{{Age in years and months/sandbox||||2012|2|20}}
→ −12年5個月
{{Age in years and months||2012-2-20}}
{{Age in years and months||2012-2-20}}
→ −12年5個月{{Age in years and months/sandbox||2012-2-20}}
→ −12年5個月
{{Age in years and months||20 Feb 2012}}
{{Age in years and months||20 Feb 2012}}
→ −12年5個月{{Age in years and months/sandbox||20 Feb 2012}}
→ −12年5個月
{{Age in years and months||Feb 20, 2012}}
{{Age in years and months||Feb 20, 2012}}
→ −12年5個月{{Age in years and months/sandbox||Feb 20, 2012}}
→ −12年5個月
{{Age in years and months|year1=2001|month1=1|day1=10}}
{{Age in years and months|year1=2001|month1=1|day1=10}}
→ 23年7個月{{Age in years and months/sandbox|year1=2001|month1=1|day1=10}}
→ 23年7個月
{{Age in years and months|year=2001|month=1|day=10}}
{{Age in years and months|year=2001|month=1|day=10}}
→ 23年7個月{{Age in years and months/sandbox|year=2001|month=1|day=10}}
→ 23年7個月
{{Age in years and months|2001|1|10}}
{{Age in years and months|2001|1|10}}
→ 23年7個月{{Age in years and months/sandbox|2001|1|10}}
→ 23年7個月
{{Age in years and months|2001-1-10}}
{{Age in years and months|2001-1-10}}
→ 23年7個月{{Age in years and months/sandbox|2001-1-10}}
→ 23年7個月
{{Age in years and months|10 Jan 2001}}
{{Age in years and months|10 Jan 2001}}
→ 23年7個月{{Age in years and months/sandbox|10 Jan 2001}}
→ 23年7個月
{{Age in years and months|January 10, 2001}}
{{Age in years and months|January 10, 2001}}
→ 23年7個月{{Age in years and months/sandbox|January 10, 2001}}
→ 23年7個月
測試 3
[編輯]時間和歲數用age參數區分:
{{Age in years and months|year2=2012|month2=2|day2=20|age=no}}
{{Age in years and months|year2=2012|month2=2|day2=20|age=no}}
→ −12年5個月{{Age in years and months/sandbox|year2=2012|month2=2|day2=20|age=no}}
→ −12年5個月
{{Age in years and months||||2012|2|20|age=false}}
{{Age in years and months||||2012|2|20|age=false}}
→ −12年5個月{{Age in years and months/sandbox||||2012|2|20|age=false}}
→ −12年5個月
{{Age in years and months||2012-2-20|age=off}}
{{Age in years and months||2012-2-20|age=off}}
→ −12年5個月{{Age in years and months/sandbox||2012-2-20|age=off}}
→ −12年5個月
{{Age in years and months||20 Feb 2012|age=on}}
{{Age in years and months||20 Feb 2012|age=on}}
→ −12歲5個月{{Age in years and months/sandbox||20 Feb 2012|age=on}}
→ −12歲5個月
{{Age in years and months||Feb 20, 2012|age=true}}
{{Age in years and months||Feb 20, 2012|age=true}}
→ −12歲5個月{{Age in years and months/sandbox||Feb 20, 2012|age=true}}
→ −12歲5個月
{{Age in years and months|year1=2001|month1=1|day1=10|age=yes}}
{{Age in years and months|year1=2001|month1=1|day1=10|age=yes}}
→ 23歲7個月{{Age in years and months/sandbox|year1=2001|month1=1|day1=10|age=yes}}
→ 23歲7個月
{{Age in years and months|year=2001|month=1|day=10}}
{{Age in years and months|year=2001|month=1|day=10}}
→ 23年7個月{{Age in years and months/sandbox|year=2001|month=1|day=10}}
→ 23年7個月
測試 4
[編輯]Examples using the range
parameter follow.
{{Age in years and months|year=2001|month=1|year2=2012|month2=2|range=yes}}
{{Age in years and months|year=2001|month=1|year2=2012|month2=2|range=yes}}
→ 11年0或1個月{{Age in years and months/sandbox|year=2001|month=1|year2=2012|month2=2|range=yes}}
→ 11年0或1個月
{{Age in years and months|2001|1||2012|2|range=yes}}
{{Age in years and months|2001|1||2012|2|range=yes}}
→ 11年0或1個月{{Age in years and months/sandbox|2001|1||2012|2|range=yes}}
→ 11年0或1個月
{{Age in years and months|Jan 2001|Feb 2012|range=yes}}
{{Age in years and months|Jan 2001|Feb 2012|range=yes}}
→ 11年0或1個月{{Age in years and months/sandbox|Jan 2001|Feb 2012|range=yes}}
→ 11年0或1個月
{{Age in years and months|Jan 2001|Feb 2012|range=dash}}
{{Age in years and months|Jan 2001|Feb 2012|range=dash}}
→ 11年0—1個月{{Age in years and months/sandbox|Jan 2001|Feb 2012|range=dash}}
→ 11年0—1個月
{{Age in years and months|Jan 2001|Feb 2012|range=no}}
{{Age in years and months|Jan 2001|Feb 2012|range=no}}
→ 11年1個月{{Age in years and months/sandbox|Jan 2001|Feb 2012|range=no}}
→ 11年1個月- (assume 1 Jan 2001 to 1 Feb 2012)
{{Age in years and months|12 Jan 2001|Feb 2012|range=no}}
{{Age in years and months|12 Jan 2001|Feb 2012|range=no}}
→ 11年1個月{{Age in years and months/sandbox|12 Jan 2001|Feb 2012|range=no}}
→ 11年1個月- (assume 12 Jan 2001 to 12 Feb 2012)
{{Age in years and months|2001|2012|range=no}}
{{Age in years and months|2001|2012|range=no}}
→ 11年{{Age in years and months/sandbox|2001|2012|range=no}}
→ 11年- (assume 1 Jan 2001 to 1 Jan 2012)
{{Age in years and months|2001|23 Feb 2012|range=no}}
{{Age in years and months|2001|23 Feb 2012|range=no}}
→ 11年{{Age in years and months/sandbox|2001|23 Feb 2012|range=no}}
→ 11年- (assume 23 Feb 2001 to 23 Feb 2012)
測試 5
[編輯]The sort key is based on the age in days, and fractions of a day if a time is specified.
{{Age in years and months|10 Jan 2001|20 Feb 2012|sortable=debug}}
{{Age in years and months|10 Jan 2001|20 Feb 2012|sortable=debug}}
→ <span style="border:1px solid;display:inline;" class="sortkey">7003405800000000000♠</span>11年1個月{{Age in years and months/sandbox|10 Jan 2001|20 Feb 2012|sortable=debug}}
→ <span style="border:1px solid;display:inline;" class="sortkey">7003405800000000000♠</span>11年1個月
{{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug}}
{{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug}}
→ <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>11年1個月{{Age in years and months/sandbox|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug}}
→ <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>11年1個月
{{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug|show=hide}}
{{Age in years and months|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug|show=hide}}
→ <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>{{Age in years and months/sandbox|10 Jan 2001|6:00 am 20 Feb 2012|sortable=debug|show=hide}}
→ <span style="border:1px solid;display:inline;" class="sortkey">7003405825000000000♠</span>
測試 6
[編輯]An extra day is added for a duration.
{{Age in years and months|20 Jan 2001|19 Feb 2012}}
{{Age in years and months|20 Jan 2001|19 Feb 2012}}
→ 11年{{Age in years and months/sandbox|20 Jan 2001|19 Feb 2012}}
→ 11年- (one day short of 11 years, 1 month)
{{Age in years and months|20 Jan 2001|19 Feb 2012|duration=on}}
{{Age in years and months|20 Jan 2001|19 Feb 2012|duration=on}}
→ 11年1個月{{Age in years and months/sandbox|20 Jan 2001|19 Feb 2012|duration=on}}
→ 11年1個月
測試 7
[編輯]The least-significant time unit can be rounded.
{{Age in years and months|20 Jan 2001|10 Feb 2012}}
{{Age in years and months|20 Jan 2001|10 Feb 2012}}
→ 11年{{Age in years and months/sandbox|20 Jan 2001|10 Feb 2012}}
→ 11年
{{Age in years and months|20 Jan 2001|10 Feb 2012|round=on}}
{{Age in years and months|20 Jan 2001|10 Feb 2012|round=on}}
→ 11年1個月{{Age in years and months/sandbox|20 Jan 2001|10 Feb 2012|round=on}}
→ 11年1個月- (round to nearest month)
測試 8
[編輯]Large numbers can be formatted with commas.
{{Age in years and months|120|2012|format=commas|range=yes}}
{{Age in years and months|120|2012|format=commas|range=yes}}
→ 1,891或1,892年{{Age in years and months/sandbox|120|2012|format=commas|range=yes}}
→ 1,891或1,892年
{{Age in years and months|120|2012|format=commas|range=dash}}
{{Age in years and months|120|2012|format=commas|range=dash}}
→ 1,891—1,892年{{Age in years and months/sandbox|120|2012|format=commas|range=dash}}
→ 1,891—1,892年