Template:AgeFull: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(existing code from WP's template "How long ago", formatted for readability, but with extant bugs)
 
(whoops, well that was a waste of time, here's a better version I just found)
Line 1: Line 1:
{{AgeFull/exp
{{#if:{{{year|}}}
|
|{{#if:{{{month|}}}
{{#ifexpr:
   |{{#if:{{{day|}}}
   (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
  |{{For year month day/display
     (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
     |years={{#expr:{{CURRENTYEAR}}-{{{year}}}-{{#ifexpr:{{CURRENTMONTH}}>{{{month}}}
  > {{{2|{{{month|12}}}}}}
    |0
  |
    |{{#ifexpr:{{CURRENTMONTH}}<{{{month}}}
  {{#expr:{{#expr:((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0}} -
      |1
    {{{1|{{{year|2005}}}}}}}}
      |{{#ifexpr:{{CURRENTDAY}}>={{{day}}}
  |
      |0
  {{#ifexpr:
      |1
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      }}
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
      }}
    < {{{2|{{{month|12}}}}}}
    }}}}
    |
    |months={{#expr:{{CURRENTMONTH}}-{{{month}}}+{{#ifexpr:{{CURRENTDAY}}>={{{day}}}
    {{#expr:{{#expr:((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0}} -
    |{{#ifexpr:{{CURRENTMONTH}}>={{{month}}}
      {{{1|{{{year|2005}}}}}} - 1 }}
      |0
     |
      |12
    {{#ifexpr:
      }}
      (((({{#time:YmdHis}} / 1000000) round 0))) -
    |{{#ifexpr:{{CURRENTMONTH}}>{{{month}}}
        (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) * 100
      |-1
      >= {{{day|31}}}
      |11
      |
      }}
      {{#expr:{{#expr:((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0}} -
    }}}}
        {{{1|{{{year|2005}}}}}}}}
     |days={{#ifexpr:{{CURRENTDAY}}>={{{day}}}
       |
    |{{#expr:{{CURRENTDAY}}-{{{day}}}
       {{#expr:{{#expr:((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0}} -
      }}
        {{{1|{{{year|2005}}}}}} - 1}}
    |{{#expr:{{Gregorian serial date
      |year={{CURRENTYEAR}}
      |month={{CURRENTMONTH}}
      |day={{CURRENTDAY}}}}-{{Gregorian serial date
       |year={{CURRENTYEAR}}
       |month={{#expr:{{CURRENTMONTH}}-1}}
      |day={{{day}}}
      }}}}
    }}
     }}
     }}
  }}
  |{{#ifexpr:{{CURRENTMONTH}}={{{month}}}
}}
    |{{#ifexpr:{{CURRENTYEAR}}={{{year}}}
|
    |0&nbsp;years
{{#ifexpr:
    |{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}}&nbsp;or {{For year month day/display
  (((({{#time:YmdHis}} / 1000000) round 0))) -
       |years={{#expr:{{CURRENTYEAR}}-{{{year}}}}}
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) * 100
       }}
  >= {{{3|{{{day|31}}}}}}
    }}
  |
    |{{#ifexpr:{{CURRENTMONTH}}>{{{month}}}
  {{#ifexpr:
    |{{#ifexpr:{{CURRENTYEAR}}={{{year}}}
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      |<!--null value-->
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100 -
       |{{For year month day/display
      {{{2|{{{month|31}}}}}}
      |years={{#expr:{{CURRENTYEAR}}-{{{year}}}}}
    >= 0
      }} and
    |
       }} {{#expr:{{CURRENTMONTH}}-{{{month}}}-1}}&nbsp;or {{For year month day/display
    {{#expr:(((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
       |months={{#expr:{{CURRENTMONTH}}-{{{month}}}}}
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100 -
      {{{2|{{{month|12}}}}}}}}
    |
    {{#expr:(((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100 -
      {{{2|{{{month|12}}}}}} + 12}}
  }}
  |
  {{#ifexpr:
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100 -
       {{{2|{{{month|31}}}}}}
    > 0
    |
    {{#expr:(((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100 -
      {{{2|{{{month|12}}}}}} - 1}}
    |
    {{#expr:(((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
       (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100 -
      {{{2|{{{month|12}}}}}} + 11}}
  }}
}}
|
{{#ifexpr:
  (((({{#time: YmdHis}} / 1000000) round 0))) -
    (((({{#time: YmdHis}} / 1000000) round 0)) / 100 round 0) * 100
  >= {{{3|{{{day|31}}}}}}
  |
  {{#expr:{{#expr:(((({{#time:YmdHis}} / 1000000) round 0))) -
    (((({{#time: YmdHis}} / 1000000) round 0)) / 100 round 0) * 100}} -
    {{{3|{{{day|31}}}}}}}}
  |
  {{#ifexpr:
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
    = 5
    or
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
    = 7
    or
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
    = 10
    or
    (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
       (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
    = 12
    |
    {{#expr:{{#expr:(((({{#time:YmdHis}} / 1000000) round 0))) -
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) * 100}} -
      {{{3|{{{day|31}}}}}} + 30}}
    |
    {{#ifexpr:
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
       = 1
      or
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
      = 2
      or
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
      = 4
      or
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
      = 6
      or
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
      = 8
      or
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
       = 9
      or
      (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0) * 100
      = 11
      |
      {{#expr:{{#expr:(((({{#time:YmdHis}} / 1000000) round 0))) -
        (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) * 100 }} -
        {{{3|{{{day|31}}}}}} + 31 }}
      |
      {{#ifexpr:
        ((({{#time:YmdHis}} / 1000000) round 0)) / 10000 round 0 mod 4
        = 0
        |
        {{#expr:{{#expr:(((({{#time:YmdHis}} / 1000000) round 0))) -
          (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) * 100}} -
          {{{3|{{{day|31}}}}}} + 29}}
        |
        {{#expr:{{#expr:(((({{#time:YmdHis}} / 1000000) round 0))) -
          (((({{#time:YmdHis}} / 1000000) round 0)) / 100 round 0) * 100 }} -
          {{{3|{{{day|31}}}}}} + 28}}
       }}
       }}
    |{{#ifexpr:{{CURRENTYEAR}}={{#expr:{{{year}}}+1}}
      |<!--null value-->
      |{{For year month day/display
      |years={{#expr:{{CURRENTYEAR}}-{{{year}}}-1}}
      }} and
      }} {{#expr:{{CURRENTMONTH}}-{{{month}}}+11}}&nbsp;or {{#expr:{{CURRENTMONTH}}-{{{month}}}+12}}&nbsp;months
    }}
    }}
  }}
  |{{#ifexpr:{{CURRENTYEAR}}={{{year}}}
  |0&nbsp;years
  |{{#expr:{{CURRENTYEAR}}-{{{year}}}-1}}&nbsp;or {{For year month day/display
    |years={{#expr:{{CURRENTYEAR}}-{{{year}}}}}
     }}
     }}
  }}
   }}
   }}
}}
|some time
}}
}}

Revision as of 16:59, 12 June 2013

some time