Difference between revisions of "Template:StaticMeetingCountdown"

From Free Software Directory
Jump to: navigation, search
(+documentation.)
m (+positive approximation of the weekly countdown; *better syntax.)
Line 1: Line 1:
 
<noinclude>
 
<noinclude>
 
Static countdown for weekly meetings.<br>
 
Static countdown for weekly meetings.<br>
Stages, based on the amount of time before the next weekly meeting:
+
Stages, based on the amount of <b>T</b>ime before the next weekly meeting:
 
<ol>
 
<ol>
<li>T > 1 day: show the number of remaining days;</li>
+
<li><b>T</b> > 1 day: show the number of remaining days;</li>
<li>T < 1 day: show the number of remaining hours;</li>
+
<li><b>T</b> < 1 day: show the number of remaining hours;</li>
<li>T < 1 hour: show the number of remaining minutes;</li>
+
<li><b>T</b> < 1 hour: show the number of remaining minutes;</li>
<li>T < 0 (meeting started): announce the meeting.</li>
+
<li><b>T</b> < 1 second: announce the meeting;</li>
<li>Day after: restart the cycle.</li>
+
<li>Next morning: restart the cycle.</li>
 
</ol>
 
</ol>
Without parameters (and here), the template shows an example countdown. The accuracy of the calculations depends on the caches involved in the network requests.<br>
+
Without parameters (and here), the template shows an example countdown. The accuracy of the calculations depends on the local instance of MediaWiki and from network caching.<br>
 
Instructions ("parameter=default:type := definition"):
 
Instructions ("parameter=default:type := definition"):
 
<ul>
 
<ul>
<li>day_name=Friday:string    := day of the week in extended format. Case-sensitive: always start with a capital letter.</li>
+
<li><b>day_name</b>=<i>Friday:string</i>     := day of the week in extended format. Case-sensitive: always start with a capital letter.</li>
<li>start_hour_time=12:integer := hour of the day. Use UTC.</li>
+
<li><b>start_hour_time</b>=<i>12:integer</i> := hour of the day. Use UTC.</li>
 
</ul>
 
</ul>
 
Contact me in case of technical problems. --[[User:LorenzoAncora|LorenzoAncora]] ([[User talk:LorenzoAncora|talk]])
 
Contact me in case of technical problems. --[[User:LorenzoAncora|LorenzoAncora]] ([[User talk:LorenzoAncora|talk]])
Line 20: Line 20:
 
{{#ifexpr:
 
{{#ifexpr:
 
   {{#expr: {{#time: U | next {{{day_name|Friday}}} + {{{start_hour_time|12}}} hours }} - {{#time: U | now }} }} > 3599 and {{#ifeq: {{CURRENTDAYNAME}} | {{{day_name|Friday}}} | 0 | 1}}
 
   {{#expr: {{#time: U | next {{{day_name|Friday}}} + {{{start_hour_time|12}}} hours }} - {{#time: U | now }} }} > 3599 and {{#ifeq: {{CURRENTDAYNAME}} | {{{day_name|Friday}}} | 0 | 1}}
| {{#ifexpr: {{#expr: {{#time: U | next {{{day_name|Friday}}} + {{{start_hour_time|12}}} hours }} - {{#time: U | now }} }} > 86400 and {{#ifeq: {{CURRENTDAYNAME}} | {{{day_name|Friday}}} | 0 | 1}}
+
| {{#ifexpr:
   | {{#expr: trunc (({{#time: U | next {{{day_name|Friday}}} + {{{start_hour_time|12}}} hours }} - {{#time: U | now }}) / 86400) }} days until next meeting
+
    {{#expr: {{#time: U | next {{{day_name|Friday}}} + {{{start_hour_time|12}}} hours }} - {{#time: U | now }} }} > 86400 and {{#ifeq: {{CURRENTDAYNAME}} | {{{day_name|Friday}}} | 0 | 1}}
 +
   | {{#expr: ceil (({{#time: U | next {{{day_name|Friday}}} + {{{start_hour_time|12}}} hours }} - {{#time: U | now }}) / 86400) }} days until next meeting
 
   | {{#expr: trunc (({{#time: U | today + {{{start_hour_time|12}}} hours + 5 hours }} - {{#time: U | now }} ) / 3600) }} hours until next meeting
 
   | {{#expr: trunc (({{#time: U | today + {{{start_hour_time|12}}} hours + 5 hours }} - {{#time: U | now }} ) / 3600) }} hours until next meeting
 
   }}
 
   }}
| {{#ifexpr: {{#expr: (({{#time: U | today + {{{start_hour_time|12}}} hours + 5 hours }} - {{#time: U | now }}) / 60)}}
+
| {{#ifexpr:
 +
    {{#expr: (({{#time: U | today + {{{start_hour_time|12}}} hours + 5 hours }} - {{#time: U | now }}) / 60)}}
 
   | past today's meeting start time
 
   | past today's meeting start time
 
   | {{#expr: trunc (({{#time: U | today + {{{start_hour_time|12}}} hours + 5 hours }} - {{#time: U | now }}) / 60)}} minutes until next meeting
 
   | {{#expr: trunc (({{#time: U | today + {{{start_hour_time|12}}} hours + 5 hours }} - {{#time: U | now }}) / 60)}} minutes until next meeting
 
   }}
 
   }}
 
}}
 
}}

Revision as of 09:25, 15 February 2020

Static countdown for weekly meetings.
Stages, based on the amount of Time before the next weekly meeting:

  1. T > 1 day: show the number of remaining days;
  2. T < 1 day: show the number of remaining hours;
  3. T < 1 hour: show the number of remaining minutes;
  4. T < 1 second: announce the meeting;
  5. Next morning: restart the cycle.

Without parameters (and here), the template shows an example countdown. The accuracy of the calculations depends on the local instance of MediaWiki and from network caching.
Instructions ("parameter=default:type := definition"):

  • day_name=Friday:string  := day of the week in extended format. Case-sensitive: always start with a capital letter.
  • start_hour_time=12:integer := hour of the day. Use UTC.

Contact me in case of technical problems. --LorenzoAncora (talk)


3 days until next meeting



Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the page “GNU Free Documentation License”.

The copyright and license notices on this page only apply to the text on this page. Any software or copyright-licenses or other similar notices described in this text has its own copyright notice and license, which can usually be found in the distribution or license text itself.