"टेम्पलेट:Time ago" की अवतरण में अंतर

recode, and support for min_magnitude parameter
imported>MSGJ
(support for "magnitude" parameter, per discussion)
imported>MSGJ
(recode, and support for min_magnitude parameter)
{{#iferror: {{#time:U| {{{1|}}} }}
|{{error|Error: first parameter cannot be parsed as a date or time.}}
|{{Time ago/core
|{{#if: {{{magnitude|}}}
|years time = {{{magnitude1|}}}
|{{#expr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / {{#switch:{{{magnitude}}}
|auto_magnitude_num = {{#if:{{{magnitude|}}}
|minutes = 60
|0<!-- Make sure the specified {{{magnitude}}} is used -->
|hours = 3600
|{{#expr:{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 120 ) | 1 | 0 }}+
|days = 86400
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 7200 ) | 1 | 0 }}+
|weeks = 604800
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 172800 ) | 1 | 0 }}+
|months = 2678400
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 5356800 ) | 12 | 0 }}+
|years = 31557600
| {{#exprifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / {{#switch:{{{magnitude}63115200 ) | 1 | 0 }}
|#default= 1
}}
}} ) }} {{#switch:{{{magnitude}}}
|minutes
|hours
|days
|weeks
|months
|years = {{{magnitude}}}
|#default= seconds
}}
|min_magnitude_num <!--= No specific magnitude -->{{#switch:{{#exprif:{{{magnitude|}}}
|{{#if: {{{magnitude|}}}
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 120 ) | 1 | 0 }}+
|{{{min_magnitude}}}
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 7200 ) | 1 | 0 }}+
}}
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 172800 ) | 1 | 0 }}+
|years = 315576006
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 5356800 ) | 1 | 0 }}+
|months = 26784005
{{#ifexpr: floor( abs( {{#time:U}} - {{#time:U| {{{1|}}} }} ) / 63115200 ) | 1 | 0 }}
|weeks = 6048004
|days = 864003
|hours = 36002
|minutes = 601
|#default= seconds
|#default= 10
}}
|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
|&#32;ago
|' time
}}
}}<noinclude>
नामालूम प्रयोगकर्ता