Template:Time ago

From Sabayon Wiki
Jump to: navigation, search

{{#iferror: {{#time:U| }}

|<{{#switch:{{{tag}}}
|p=p
|span=span
|div=div
|#default=strong

}} class="error">Error: first parameter cannot be parsed as a date or time.</{{#switch:{{{tag}}}

|p=p
|span=span
|div=div
|#default=strong

}}>

|{{#ifexpr:{{#time:U}}>={{#time:U|}}

|{{#switch:{{#invoke:Math|max}}

|0 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}}))}} seconds
|1 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/60)}} minutes
|2 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/3600)}} hours
|3 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/86400)}} days
|4 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/604800)}} weeks
|5 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/2678400)}} months
|6 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/31557600)}} years

}} ago |{{#switch:{{#invoke:Math|max}}

|0 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}}))}} seconds'
|1 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/60)}} minutes'
|2 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/3600)}} hours'
|3 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/86400)}} days'
|4 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/604800)}} weeks'
|5 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/2678400)}} months'
|6 = {{#expr:floor(abs({{#time:U}}-{{#time:U|}})/31557600)}} years'

}} time }} }}{{#ifeq:|yes| (purge)|}}{{#ifeq: Time ago | sandbox

|
Template:Template sandbox notice

}}{{#switch:

 {{#if:
 | {{{demospace}}}    
 | {{#ifeq:Template|Template
   | template
   | other
   }}
 }}

| template = {{#ifeq: | sysop

 | {{#ifeq:{{#switch:{{#switch:{{#ifeq:-|-sysop|move|}}
  |semi
  |autoconfirmed=semi
  |administrator
  |full
  |sysop=indef
  |move=move
  |#default=indef}}
 |move={{#ifeq:
     {{#switch:{{#ifeq:time ago/template|time ago/template|undefined|{{#ifeq:time ago|sandbox|sysop|undefined}}}}
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = }}
     |sysop|yes|no
   }}
 |create={{#if:
     {{#switch:{{#ifeq:time ago/template|time ago/template|undefined|{{#ifeq:time ago|sandbox|sysop|undefined}}}}
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = }}
     |yes|no
   }}
 |pc1 ={{#ifeq:
     {{#switch:{{#ifeq:time ago/template|time ago/template|undefined|{{#ifeq:time ago|sandbox|sysop|undefined}}}}
       |pc1                           = autoconfirmed 
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = }}
     |autoconfirmed
     |yes|no
   }}
 |pc2 ={{#ifeq:
     {{#switch:{{#ifeq:time ago/template|time ago/template|undefined|{{#ifeq:time ago|sandbox|sysop|undefined}}}}
       |pc2                           = review 
       |undefined                     = Template:PENDINGCHANGELEVEL
       |#default                      = }}
     |review
     |yes|no
   }}

|#default={{#if:

     {{#switch:{{#ifeq:time ago/template|time ago/template|undefined|{{#ifeq:time ago|sandbox|sysop|undefined}}}}
       |semi |autoconfirmed           = autoconfirmed
       |administrator |full |sysop    = sysop
       |undefined                     = 
       |#default                      = }}
     |{{#ifeq:{{#switch:
                |semi |autoconfirmed           = autoconfirmed
                |administrator |full |sysop    = sysop
                |#default                      = }}
        |{{#switch:{{#ifeq:time ago/template|time ago/template|undefined|{{#ifeq:time ago|sandbox|sysop|undefined}}}}
           |semi |autoconfirmed           = autoconfirmed
           |administrator |full |sysop    = sysop
           |undefined                     = 
           |#default                      = }}
        |no|yes
      }}
  |no}}

}}|yes|{{#ifeq:yes|yes| {{#switch:{{#switch:{{#ifeq:-|-sysop|move|}}

  |semi
  |autoconfirmed=semi
  |administrator
  |full
  |sysop=indef
  |move=move
  |#default=indef}} 
| pc1 | pc2 =