Template: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年9个月{{Age in years and months/sandbox|year2=2012|month2=2|day2=20}}
→ −12年9个月
{{Age in years and months||||2012|2|20}}
{{Age in years and months||||2012|2|20}}
→ −12年9个月{{Age in years and months/sandbox||||2012|2|20}}
→ −12年9个月
{{Age in years and months||2012-2-20}}
{{Age in years and months||2012-2-20}}
→ −12年9个月{{Age in years and months/sandbox||2012-2-20}}
→ −12年9个月
{{Age in years and months||20 Feb 2012}}
{{Age in years and months||20 Feb 2012}}
→ −12年9个月{{Age in years and months/sandbox||20 Feb 2012}}
→ −12年9个月
{{Age in years and months||Feb 20, 2012}}
{{Age in years and months||Feb 20, 2012}}
→ −12年9个月{{Age in years and months/sandbox||Feb 20, 2012}}
→ −12年9个月
{{Age in years and months|year1=2001|month1=1|day1=10}}
{{Age in years and months|year1=2001|month1=1|day1=10}}
→ 23年10个月{{Age in years and months/sandbox|year1=2001|month1=1|day1=10}}
→ 23年10个月
{{Age in years and months|year=2001|month=1|day=10}}
{{Age in years and months|year=2001|month=1|day=10}}
→ 23年10个月{{Age in years and months/sandbox|year=2001|month=1|day=10}}
→ 23年10个月
{{Age in years and months|2001|1|10}}
{{Age in years and months|2001|1|10}}
→ 23年10个月{{Age in years and months/sandbox|2001|1|10}}
→ 23年10个月
{{Age in years and months|2001-1-10}}
{{Age in years and months|2001-1-10}}
→ 23年10个月{{Age in years and months/sandbox|2001-1-10}}
→ 23年10个月
{{Age in years and months|10 Jan 2001}}
{{Age in years and months|10 Jan 2001}}
→ 23年10个月{{Age in years and months/sandbox|10 Jan 2001}}
→ 23年10个月
{{Age in years and months|January 10, 2001}}
{{Age in years and months|January 10, 2001}}
→ 23年10个月{{Age in years and months/sandbox|January 10, 2001}}
→ 23年10个月
测试 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年9个月{{Age in years and months/sandbox|year2=2012|month2=2|day2=20|age=no}}
→ −12年9个月
{{Age in years and months||||2012|2|20|age=false}}
{{Age in years and months||||2012|2|20|age=false}}
→ −12年9个月{{Age in years and months/sandbox||||2012|2|20|age=false}}
→ −12年9个月
{{Age in years and months||2012-2-20|age=off}}
{{Age in years and months||2012-2-20|age=off}}
→ −12年9个月{{Age in years and months/sandbox||2012-2-20|age=off}}
→ −12年9个月
{{Age in years and months||20 Feb 2012|age=on}}
{{Age in years and months||20 Feb 2012|age=on}}
→ −12岁9个月{{Age in years and months/sandbox||20 Feb 2012|age=on}}
→ −12岁9个月
{{Age in years and months||Feb 20, 2012|age=true}}
{{Age in years and months||Feb 20, 2012|age=true}}
→ −12岁9个月{{Age in years and months/sandbox||Feb 20, 2012|age=true}}
→ −12岁9个月
{{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岁10个月{{Age in years and months/sandbox|year1=2001|month1=1|day1=10|age=yes}}
→ 23岁10个月
{{Age in years and months|year=2001|month=1|day=10}}
{{Age in years and months|year=2001|month=1|day=10}}
→ 23年10个月{{Age in years and months/sandbox|year=2001|month=1|day=10}}
→ 23年10个月
测试 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年