Main Page
Difference between revisions of "Template:Countdown"
Jump to navigation
Jump to search
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | <includeonly><div>{{#ifexpr:{{#time:U| | + | <includeonly><div class="hidden"><!-- |
− | < | + | -->{{#if:{{{TimeStart|}}}{{{TimeEnd|}}}<!-- |
− | + | -->|{{#iferror:{{#ifexpr:{{#time:U|{{{TimeStart|}}} {{{Offset|{{{TimeStartOffset|}}}}}}}}<{{#time:U|{{{TimeEnd|}}} {{{Offset|{{{TimeEndOffset|}}}}}}}}}}<!-- | |
− | + | -->||{{#ifexpr:{{#time:U|{{#time:F d, Y h:i:s A e|}}}}<{{#time:U|{{#time:F d, Y h:i:s A e|{{#if:{{{TimeStart|}}}|{{{TimeStart}}} {{{Offset|{{{TimeStartOffset|}}}}}}|}}}}}}<!-- | |
− | + | -->|{{#if:{{{Region|}}}|({{{Region}}})|}} Starts in: <!-- | |
− | + | --><span data-end="toggle" data-toggle="next" data-options="no-leading-zeros short-format" class="countdown" style="display:none;"><span class="countdowndate" style="font-weight:bold">{{#time:F d, Y h:i:s A e|{{#if:{{{TimeStart|}}}|{{{TimeStart}}} {{{Offset|{{{TimeStartOffset|}}}}}}|}}}}</span></span><!-- | |
− | + | --><span style="display:none;">Event has started. <small>[{{fullurl:{{FULLPAGENAME}}|action=purge}} Purge page]</small></span><!-- | |
− | + | -->|{{#ifexpr:{{#time:U|{{#time:F d, Y h:i:s A e|}}}}<{{#time:U|{{#time:F d, Y h:i:s A e|{{#if:{{{TimeEnd|}}}|{{{TimeEnd}}} {{{Offset|{{{TimeEndOffset|}}}}}}|}}}}}}|{{#if:{{{Region|}}}|({{{Region}}})|}} Ends in: <!-- | |
− | + | --><span data-end="toggle" data-toggle="next" data-options="no-leading-zeros short-format" class="countdown" style="display:none;"><span class="countdowndate" style="font-weight:bold">{{#time:F d, Y h:i:s A e|{{#if:{{{TimeEnd|}}}|{{{TimeEnd}}} {{{Offset|{{{TimeEndOffset|}}}}}}|}}}}</span></span><!-- | |
− | | | + | --><span style="display:none;">Event has concluded. <small>[{{fullurl:{{FULLPAGENAME}}|action=purge}} Purge page]</small></span>|}}<!-- |
− | + | -->}}<!-- | |
− | }} | + | -->}}<!-- |
− | </ | + | -->|}}<!-- |
− | + | --></div></includeonly><!-- | |
− | + | --><noinclude>{{documentation}}</noinclude> | |
− | {{ | ||
− | |||
− | |||
− | |||
− | }} | ||
− | |||
− | |||
− | |||
− | |||
− |
Latest revision as of 15:33, 27 January 2021
[edit] [ ] Template documentation
Main article: Template:Countdownall
Parameters
Parameter | Description |
---|---|
Region | (Optional) Region to be stated next to the countdown. |
Offset | (Optional) Offset is a special parameter (usually timezone, e.g. GMT+8) that must be used if you are an author of templates incorporating countdown and are parsing one input into multiple timezone outputs, in that case, do not forcefeed an offset by hand into the template and use this parameter instead. This is because if there are some users that leave blank inputs, those blanks will be combined with your forcefed offset to form midnight + your offset. |
EventName | Event name, must be unique, or the countdown end message will display for all countdowns once one TimeEnd is reached.
|
TimeStart | Start date and time, accepts all formats except those that contain fullstops.
|
TimeEnd | End date and time, accepts all formats except those that contain fullstops. |
Examples
Case: Offset
{{Countdown |Region=AS |EventName=Offset1 |TimeStart=2024/01/15 23:00:00 |TimeEnd=2025/01/31 03:59:59 |Offset=GMT+8 }}
(AS) Ends in:
Case: Upcoming
{{Countdown |Region=AS |EventName=TemplateExample1 |TimeStart=2025/01/15 23:00:00 GMT+8 |TimeEnd=2025/01/31 03:59:59 GMT+8 }}
(AS) Starts in:
Case: Started
{{Countdown |Region=AS |EventName=TemplateExample2 |TimeStart=2021-01-8 10:00:00 GMT+8 |TimeEnd=2025-01-31 03:59:59 GMT+8 }}
(AS) Ends in:
Case: Long Ended
{{Countdown |Region=AS |EventName=TemplateExample3 |TimeStart=2020-01-16 10:00:00 GMT+8 |TimeEnd=2020-01-31 03:59:59 GMT+8 }}
Case: Blank Start
{{Countdown |Region=AS |EventName=TemplateExample4 |TimeStart= |TimeEnd=2025-01-31 03:59:59 GMT+8 }}
(AS) Ends in:
Case: Blank Start Ended
{{Countdown |Region=AS |EventName=TemplateExample4 |TimeStart= |TimeEnd=2020-01-31 03:59:59 GMT+8 }}
Case: Blank End
{{Countdown |Region=AS |EventName=TemplateExample5 |TimeStart=2025-01-31 03:59:59 GMT+8 |TimeEnd= }}
(AS) Starts in:
Case: Blank End Started
{{Countdown |Region=AS |EventName=TemplateExample5 |TimeStart=2020-01-31 03:59:59 GMT+8 |TimeEnd= }}
Case: Invalid Start
{{Countdown |Region=AS |EventName=TemplateExample6 |TimeStart=aaaaaaaaaaaa |TimeEnd=2025/01/31 03:59:59 GMT+8 }}
Case: Invalid End
{{Countdown |Region=AS |EventName=TemplateExample7 |TimeStart=2025/01/16 10:00:00 GMT+8 |TimeEnd=aaaaaaaaaaaa }}
Case: Invalid Start End
{{Countdown |Region=AS |EventName=TemplateExample8 |TimeStart=aaaaaaaaaaaa |TimeEnd=aaaaaaaaaaaa }}
Case: Blank
{{Countdown |Region=AS |EventName=TemplateExample9 |TimeStart= |TimeEnd= }}
General Info
(Countdown) - Parses EventName, TimeStart and TimeEnd into a countdown, mostly used on event mentioning pages.
- This template works with a JavaScript snippet imported from the developer's wiki into this wiki's MediaWiki:ImportJS. It does NOT use the countdown extension.
- Utilizes the parser functions {{#time:F d, Y h:i:s A e|}} and {{#time:F d, Y|}} and is thus able to accept a variety of formats which are parsed and stored internally as UTC.
- The following are accepted: backslashes (2019/1/1), dashes (2019-1-1), most manner of timezones (+9, +9 hours. +0930, JST, GMT +9) and commas in the correct spacing (November 20th, 2019).
- The following are not accepted and will throw errors: any dots as they cause non integer values, including dot spacing (2019.1.1) and specifying timezones in non integer (+9.5).
- If no timezone is specified e.g. October 04, 2018 06:00, the syntax automatically assumes UTC.
The above documentation is transcluded from Template:Countdown/doc. (edit | history) Editors can experiment in this template's sandbox (create) and testcases (create) pages. Please add categories and interwikis to the /doc subpage. Subpages of this template. |