Template:Human readable duration/testcases
Jump to navigation
Jump to search
| This is the template test cases page for the sandbox of Template:Human readable duration. to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki; see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins and parsers with these links: |
Invalid values
[edit source]No parameters
[edit source]{{Human readable duration}}→ Human readable duration error: First argument must be a positive number (help){{Human readable duration/sandbox}}→ Human readable duration error: First argument must be a positive number (help)
Missing second parameter
[edit source]{{Human readable duration|5}}→ Human readable duration error: Second argument must be a valid time unit (help){{Human readable duration/sandbox|5}}→ Human readable duration error: Second argument must be a valid time unit (help)
Bad first parameter
[edit source]{{Human readable duration||seconds}}→ Human readable duration error: First argument must be a positive number (help){{Human readable duration/sandbox||seconds}}→ Human readable duration error: First argument must be a positive number (help)
{{Human readable duration|yes|seconds}}→ Human readable duration error: First argument must be a positive number (help){{Human readable duration/sandbox|yes|seconds}}→ Human readable duration error: First argument must be a positive number (help)
{{Human readable duration|-5|seconds}}→ Human readable duration error: First argument must be a positive number (help){{Human readable duration/sandbox|-5|seconds}}→ Human readable duration error: First argument must be a positive number (help)
Bad second parameter
[edit source]{{Human readable duration|5|}}→ Human readable duration error: Second argument must be a valid time unit (help){{Human readable duration/sandbox|5|}}→ Human readable duration error: Second argument must be a valid time unit (help)
{{Human readable duration|5|yes}}→ Human readable duration error: Second argument must be a valid time unit (help){{Human readable duration/sandbox|5|yes}}→ Human readable duration error: Second argument must be a valid time unit (help)
Mixed case in second parameter
[edit source]{{Human readable duration|2|sEcOnDs}}→ 2 seconds{{Human readable duration/sandbox|2|sEcOnDs}}→ 2 seconds
{{Human readable duration|2|Minutes}}→ 2 minutes{{Human readable duration/sandbox|2|Minutes}}→ 2 minutes
{{Human readable duration|2|HOURS}}→ 2 hours{{Human readable duration/sandbox|2|HOURS}}→ 2 hours
{{Human readable duration|2|dayS}}→ 2 days{{Human readable duration/sandbox|2|dayS}}→ 2 days
{{Human readable duration|2|months}}→ 2 months{{Human readable duration/sandbox|2|months}}→ 2 months
{{Human readable duration|2|YEArs}}→ 2 years{{Human readable duration/sandbox|2|YEArs}}→ 2 years
Decimals in first parameter
[edit source]{{Human readable duration|2.33333333|seconds}}→ 2.5 seconds{{Human readable duration/sandbox|2.33333333|seconds}}→ 2.5 seconds
{{Human readable duration|2.0|minutes}}→ 2 minutes{{Human readable duration/sandbox|2.0|minutes}}→ 2 minutes
{{Human readable duration|2.99999999|hours}}→ 3 hours{{Human readable duration/sandbox|2.99999999|hours}}→ 3 hours
{{Human readable duration|2.75|days}}→ 66 hours{{Human readable duration/sandbox|2.75|days}}→ 66 hours
{{Human readable duration|2.00000001|months}}→ 2 months{{Human readable duration/sandbox|2.00000001|months}}→ 2 months
{{Human readable duration|2.5|years}}→ 2.5 years{{Human readable duration/sandbox|2.5|years}}→ 2.5 years
Zero
[edit source]{{Human readable duration|0|seconds}}→ 0 seconds{{Human readable duration/sandbox|0|seconds}}→ 0 seconds
{{Human readable duration|0|minutes}}→ 0 seconds{{Human readable duration/sandbox|0|minutes}}→ 0 seconds
{{Human readable duration|0|hours}}→ 0 seconds{{Human readable duration/sandbox|0|hours}}→ 0 seconds
{{Human readable duration|0|days}}→ 0 seconds{{Human readable duration/sandbox|0|days}}→ 0 seconds
{{Human readable duration|0|months}}→ 0 seconds{{Human readable duration/sandbox|0|months}}→ 0 seconds
{{Human readable duration|0|years}}→ 0 seconds{{Human readable duration/sandbox|0|years}}→ 0 seconds
Nearly zero
[edit source]{{Human readable duration|0.1|seconds}}→ 0 seconds{{Human readable duration/sandbox|0.1|seconds}}→ 0 seconds
{{Human readable duration|0.1|minutes}}→ 6 seconds{{Human readable duration/sandbox|0.1|minutes}}→ 6 seconds
{{Human readable duration|0.1|hours}}→ 6 minutes{{Human readable duration/sandbox|0.1|hours}}→ 6 minutes
{{Human readable duration|0.1|days}}→ 2.5 hours{{Human readable duration/sandbox|0.1|days}}→ 2.5 hours
{{Human readable duration|0.1|months}}→ 3 days{{Human readable duration/sandbox|0.1|months}}→ 3 days
{{Human readable duration|0.1|years}}→ 36.5 days{{Human readable duration/sandbox|0.1|years}}→ 36.5 days
Special exceptions
[edit source]{{Human readable duration|24|hours}}→ 1 day{{Human readable duration/sandbox|24|hours}}→ 1 day
{{Human readable duration|48|hours}}→ 2 days{{Human readable duration/sandbox|48|hours}}→ 2 days
Good values already (output = input)
[edit source]{{Human readable duration|1|seconds}}→ 1 second{{Human readable duration/sandbox|1|seconds}}→ 1 second
{{Human readable duration|1|minutes}}→ 1 minute{{Human readable duration/sandbox|1|minutes}}→ 1 minute
{{Human readable duration|1|hours}}→ 1 hour{{Human readable duration/sandbox|1|hours}}→ 1 hour
{{Human readable duration|1|days}}→ 1 day{{Human readable duration/sandbox|1|days}}→ 1 day
{{Human readable duration|6|months}}→ 6 months{{Human readable duration/sandbox|6|months}}→ 6 months
{{Human readable duration|2|years}}→ 2 years{{Human readable duration/sandbox|2|years}}→ 2 years
Boundary conditions
[edit source]{{Human readable duration|59.74|seconds}}→ 59.5 seconds{{Human readable duration/sandbox|59.74|seconds}}→ 59.5 seconds
{{Human readable duration|59.75|seconds}}→ 1 minute{{Human readable duration/sandbox|59.75|seconds}}→ 1 minute
{{Human readable duration|59.74|minutes}}→ 59.5 minutes{{Human readable duration/sandbox|59.74|minutes}}→ 59.5 minutes
{{Human readable duration|59.75|minutes}}→ 1 hour{{Human readable duration/sandbox|59.75|minutes}}→ 1 hour
{{Human readable duration|71.74|hours}}→ 71.5 hours{{Human readable duration/sandbox|71.74|hours}}→ 71.5 hours
{{Human readable duration|71.75|hours}}→ 3 days{{Human readable duration/sandbox|71.75|hours}}→ 3 days
{{Human readable duration|50.24|days}}→ 50 days{{Human readable duration/sandbox|50.24|days}}→ 50 days
{{Human readable duration|50.25|days}}→ 2 months{{Human readable duration/sandbox|50.25|days}}→ 2 months
{{Human readable duration|18.49|months}}→ 18 months{{Human readable duration/sandbox|18.49|months}}→ 18 months
{{Human readable duration|18.50|months}}→ 1.5 years{{Human readable duration/sandbox|18.50|months}}→ 1.5 years
Random typical values
[edit source]{{Human readable duration|2880|hours}}→ 4 months{{Human readable duration/sandbox|2880|hours}}→ 4 months
{{Human readable duration|100|days}}→ 3 months{{Human readable duration/sandbox|100|days}}→ 3 months
{{Human readable duration|10000|months}}→ 833.5 years{{Human readable duration/sandbox|10000|months}}→ 833.5 years
{{Human readable duration|30|seconds}}→ 30 seconds{{Human readable duration/sandbox|30|seconds}}→ 30 seconds
{{Human readable duration|100000|seconds}}→ 28 hours{{Human readable duration/sandbox|100000|seconds}}→ 28 hours
Additional in situ tests at Template:Talk header
[edit source]An additional set of test cases can be found at Template:Talk header/testcases4#Testing human readable time units. These tests involve observing the results of template {{Talk header}} in actual use.