Template:EventTimeLeft: Difference between revisions
RiceEmpress (talk | contribs) No edit summary |
RiceEmpress (talk | contribs) (added documentation) |
||
| Line 4: | Line 4: | ||
<noinclude> | <noinclude> | ||
This details how much time left is on an event, according to the time between now and the next 2-week waypoint in the standard 10-week event cycle. | This details how much time left is on an event, according to the time between now and the next 2-week waypoint in the standard 10-week event cycle. | ||
The countdown clocks for [[Template:EventTimeLeft|EventTimeLeft]] and [[Template:EventCountdown|EventCountdown]] use markers to count down to. [[Template:EventTimeLeftUnix|EventTimeLeftUnix]] looks at how many seconds we are into a cycle and divides it by 1209600, and returns a remainder. It subtracts that from 1209600, the amount of seconds in two weeks; this returns the amount of seconds left in this mini 2-week cycle within the greater 8-week cycle. | |||
EventTimeLeft is the countdown clock itself, and is: | |||
<nowiki><span class="countdown" data-end="stop" data-options="short-format" style="display:none;">Ends: <span class="countdowndate">{{#time:r|@{{#expr:{{EventTimeLeftUnix|cyclestart={{{cyclestart}}}}} + {{#time:U|now}}}}}}</span></span> | |||
{{#widget: CountdownTimer}}</nowiki> | |||
The time it's counting down to is <nowiki>{{#time:r|@{{#expr:{{EventTimeLeftUnix|cyclestart={{{cyclestart}}}}} + {{#time:U|now}}}}}}</nowiki>, which adds the seconds left in the 2-week cycle that is a single event to the current time in Unix (the amount of seconds elapsed since 1 January 1970), and then counts down to it. | |||
This draws on the [[:Widget:CountdownTimer|CountdownTimer]] widget required to make the countdown timers actually work; "data- | |||
[[Category:Templates]] | [[Category:Templates]] | ||
{{NOISZ Timer Flowchart}} | {{NOISZ Timer Flowchart}} | ||
</noinclude> | </noinclude> | ||
Revision as of 19:11, 5 February 2026
This details how much time left is on an event, according to the time between now and the next 2-week waypoint in the standard 10-week event cycle.
The countdown clocks for EventTimeLeft and EventCountdown use markers to count down to. EventTimeLeftUnix looks at how many seconds we are into a cycle and divides it by 1209600, and returns a remainder. It subtracts that from 1209600, the amount of seconds in two weeks; this returns the amount of seconds left in this mini 2-week cycle within the greater 8-week cycle.
EventTimeLeft is the countdown clock itself, and is:
<span class="countdown" data-end="stop" data-options="short-format" style="display:none;">Ends: <span class="countdowndate">{{#time:r|@{{#expr:{{EventTimeLeftUnix|cyclestart={{{cyclestart}}}}} + {{#time:U|now}}}}}}</span></span> {{#widget: CountdownTimer}}
The time it's counting down to is {{#time:r|@{{#expr:{{EventTimeLeftUnix|cyclestart={{{cyclestart}}}}} + {{#time:U|now}}}}}}, which adds the seconds left in the 2-week cycle that is a single event to the current time in Unix (the amount of seconds elapsed since 1 January 1970), and then counts down to it.
This draws on the CountdownTimer widget required to make the countdown timers actually work; "data-
Timer Templates