Template:EventCountdown: Difference between revisions
RiceEmpress (talk | contribs) No edit summary |
RiceEmpress (talk | contribs) (added documentation) |
||
| Line 5: | Line 5: | ||
<noinclude> | <noinclude> | ||
This counts down the time until the recurrent event for a given style, and gives a differing output format depending on how many parameters are input. | This counts down the time until the recurrent event for a given style, and gives a differing output format depending on how many parameters are input. | ||
[[Template:EventCountdown|EventCountdown]] is the clock itself using the time defined in [[Template:EventTimeCountdownUnix|EventTimeCountdownUnix]]: | |||
<nowiki> | |||
{{#if: {{{countdown|}}} | <span class="countdown" data-options="short-format" style="display:none;" data-end="callback" data-callback="selfNullEdit">Starts: <span class="countdowndate">{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}</span></span> | Starts: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}| eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}} | |||
}} | |||
{{#widget:CountdownTimer}}</nowiki> | |||
Where the first "if: countdown" part makes sure the user requested a countdown (and if not, simply displays the date and time of the next event), and the time it counts down to is: <nowiki>{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle| Attitude Mint}}}}} + {{#time:U|now}}}}}}</nowiki> | |||
This adds the time left until the next two-week marker to now, and tells the clock to count down to it. If nothing is defined, it decides the next style will be LUNATIC MAINFRAME. | |||
Example: | Example: | ||
Latest revision as of 19:28, 5 February 2026
This counts down the time until the recurrent event for a given style, and gives a differing output format depending on how many parameters are input.
EventCountdown is the clock itself using the time defined in EventTimeCountdownUnix:
{{#if: {{{countdown|}}} | <span class="countdown" data-options="short-format" style="display:none;" data-end="callback" data-callback="selfNullEdit">Starts: <span class="countdowndate">{{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}</span></span> | Starts: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}| eventstyle={{{eventstyle|LUNATIC MAINFRAME}}}}} + {{#time:U|now}}}}}}
}}
{{#widget:CountdownTimer}}
Where the first "if: countdown" part makes sure the user requested a countdown (and if not, simply displays the date and time of the next event), and the time it counts down to is: {{#time:F d, Y H:i T|@{{#expr:{{EventTimeCountdownUnix|cyclestart={{{cyclestart|}}}|eventstyle={{{eventstyle| Attitude Mint}}}}} + {{#time:U|now}}}}}}
This adds the time left until the next two-week marker to now, and tells the clock to count down to it. If nothing is defined, it decides the next style will be LUNATIC MAINFRAME.
Example:
{{EventCountdown
|eventstyle=Attitude Mint
|cyclestart=2025-12-12 04:53
|countdown=true
}}
Yields:
Timer Templates