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

Trying to simplify template design
(created)
 
(Trying to simplify template design)
{{#switch:
{{#ifexpr: abs({{#time:U}}-{{#time:U| {{{1|}}}}}) < 12*60180
| 0
| {{#expr: trunc( 1.4427 * ln( ({{#time:U}}-{{#time:U| {{{1}}}}})) - 97.3987) }}
}}
|0 <!-- < 123 min --> = less than 3 minutes ago
|1 <!-- < 236 min -->
|2 <!-- < 4512 min --> = {{#expr: ({{#time:U}} - {{#time:U|{{{1|}}}}})/60 round 0 }} minutes ago
|93 <!-- < 423 daysmin -->
|3 <!-- < 90 min --> = {{#time: G:i|{{{1|}}} }} ({{#expr: ({{#time:U}} - {{#time:U|{{{1|}}}}})/60 round 0 }} minutes ago)
|4 <!-- < 345 min hours -->
|5 <!-- < 690 min hours --> = {{#time: G:i|{{{1|}}} }} ({{#expr: ({{#time:U}} - {{#time:U|{{{1|}}}}})/360012 round 10 * 5}} hoursminutes ago)
|6 <!-- < 123 hours -->
|7 <!-- < 1 day 6 hours --> = {{#time: G:i|{{{1|}}} }} ({{#expr: ({{#time:U}} - {{#time:U|{{{1|}}}}})/3600 round 01 }} hours ago)
|8 <!-- < 2 days 12 hours--> = {{#time: G:i|{{{1|}}} }} (Yesterday)
|39 <!-- < 901 day min --> = {{#time: G:i|{{{1|}}} }} ({{#expr: ({{#time:U}} - {{#time:U|{{{1|}}}}})/603600 round 0 }} minuteshours ago)
|9 <!-- < 4 days -->
|10<!-- < 82 days --> = {{#time: G:i|{{{1|}}} }} ({{#time:l|{{{1|}}}}}) Yesterday
|11<!-- < 4 days -->
|default= {{#time: g:i A j F Y "(UTC)"|{{{1|}}} }}
|12<!-- < 8 days --> = {{#time:l|{{{1|}}}}}
|default= {{#expr: ({{#time:U}} - {{#time:U|{{{1|}}}}})/604800 round 0 }} weeks ago
}}<noinclude>
{{documentation|content=
{{tl|{{PAGENAME}}}} calculates dates and times since an event has passed.
 
== Examples ==
 
* &#123;{Time ago&#124;{{#time: r |-14 minutes}}}&#125; <br/>→<span style="background:white;">{{Time ago|-14 minutes}}</span>
== test cases ==
* <code><nowiki>{&#123;{Time ago&#124;{{#time: r |-14134 minutes}}</nowiki></code>}&#125; <br/>→<span style="background:white;">{{Time ago|-14123 minutes}}</span>
* <code><nowiki>{{Time ago|-33500 minutes}}</nowiki></code><br/>→<span style="background:white;">{{Time ago|-33500 minutes}}</span>
* <code><nowiki>{{Time ago|-123Jan minutes21, 2001 3:45 PM}}</nowiki></code><br/>→<span style="background:white;">{{Time ago|-123Jan 21 2001 3:45 minutesPM}}</span>
* <code><nowiki>{{Time ago|-500Oct minutes18 2008}}</nowiki></code><br/>→<span style="background:white;">{{Time ago|-500Oct 18 2008 minutes}}</span>
* <code><nowiki>{{Time ago|Nov 7 2008 3:45 PM}}</nowiki></code><br/>→<span style="background:white;">{{Time ago|Nov 7 2008 3:45 PM}}</span>
 
}}</noinclude>
0

संपादन