Template:Time ago: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>MSGJ xxx ago for past time, xxxs' time for future |
meta>MSGJ support for "magnitude" parameter, per discussion |
||
| Line 1: | Line 1: | ||
{{#switch: | {{#iferror: {{#time:U| {{{1|}}} }} | ||
{{# | |{{error|Error: first parameter cannot be parsed as a date or time.}} | ||
|{{#if: {{{magnitude|}}} | |||
|{{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / {{#switch:{{{magnitude}}} | |||
|minutes = 60 | |||
|hours = 3600 | |||
|days = 86400 | |||
|weeks = 604800 | |||
|months = 2678400 | |||
|years = 31557600 | |||
|#default= 1 | |||
}} ) }} {{#switch:{{{magnitude}}} | |||
|minutes | |||
|hours | |||
|days | |||
|weeks | |||
|months | |||
|years = {{{magnitude}}} | |||
|#default= seconds | |||
}} | |||
| <!-- No specific magnitude -->{{#switch:{{#expr: | |||
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 120 ) | 1 | 0 }}+ | {{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 120 ) | 1 | 0 }}+ | ||
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 7200 ) | 1 | 0 }}+ | {{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 7200 ) | 1 | 0 }}+ | ||
| Line 7: | Line 26: | ||
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 63115200 ) | 1 | 0 }} | {{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 63115200 ) | 1 | 0 }} | ||
}} | }} | ||
|0 = {{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 1 ) }} seconds | |||
|1 = {{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 60 ) }} minutes | |||
|2 = {{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 3600 ) }} hours | |||
|3 = {{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 86400 ) }} days | |||
|4 = {{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 2678400 ) }} months | |||
|5 = {{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 31557600 ) }} years | |||
}} | |||
}}{{#ifexpr: {{#time:U}} - {{#time:U| {{{1|}}} }} >= 0 | }}{{#ifexpr: {{#time:U}} - {{#time:U| {{{1|}}} }} >= 0 | ||
| ago | |||
|' time | |||
}} | |||
}}<noinclude> | }}<noinclude> | ||
{{documentation}} | {{documentation}} | ||
</noinclude> | </noinclude> | ||
Revision as of 18:40, 26 January 2010
0 seconds ago Lua error in package.lua at line 80: module 'Module:Documentation/config' not found.