Template:Event timer/doc: Difference between revisions
(basic examples. wip) |
(date formats, note on cache purging. wip) |
||
Line 7: | Line 7: | ||
Full usage: | Full usage: | ||
<pre>{{Event timer | Start = | End = | Message = | End message = | Future message = | Today = }}</pre> | <pre>{{Event timer | Start = | End = | Message = | End message = | Future message = | Today = }}</pre> | ||
<div style="width:80%; background-color: lemonchiffon; border: 2px solid darkgoldenrod; text-align: center; margin:auto;">NOTE! <br> The template doesn't work in real time, but receives the current day from the server when a new cache is loaded. As such, the template is prone to "getting stuck". If that happens, you can purge the cache. Consider including the [[Template:Purge]] in your message for user convenience.</div> | |||
=== Parameters === | === Parameters === | ||
Line 21: | Line 23: | ||
=== Dates === | === Dates === | ||
The template uses parser function <nowiki>{{#time: }}</nowiki>, which can intepret several different date formats. At least the following formats work in the template: | |||
{| class="wikitable" | |||
! Format !! Example | |||
|- | |||
| colspan="2" bgcolor=#343434 style="text-align:center; color:white;" | '''Recommended''' | |||
|- | |||
| Day number + Month name || 9 October | |||
|- | |||
| Month name + Day number || October 9 | |||
|- | |||
| Day number + Month Abbr. || 9 Oct | |||
|- | |||
| Month Abbr. + Day number || Oct 9 | |||
|- | |||
| Month/Day (US style) || 10/9 | |||
|- | |||
| colspan="2" bgcolor=#343434 style="text-align:center; color:white;" | '''Other''' | |||
|- | |||
| Month<ref group="note">Do not include the year when using only the name of the month.</ref> || Oct <br> October | |||
|- | |||
| ISO<ref group="note">Including the year is mandatory, even if it's ignored. The year can be any year.</ref> || 2023-10-09 | |||
|- | |||
| Weekdays<ref group="note">Will find the ''next'' weekday given! As such, the value "Wednesday" will refer to Wednesday this week on Monday, Tuesday and Wednesday, but to the next week's Wednesday on all the other days.</ref> || Tue <br> Tuesday | |||
|} | |||
<small><references group="note"/></small> | |||
== Examples == | == Examples == |
Revision as of 13:13, 10 October 2023
This notice was placed here by Jovenan, so go bug her to finish the page if nothing's happening.
This template shows a message between selected dates. The message will be shown annually between those dates. More flexible usage is possible as described in the documentation.
Usage
Full usage:
{{Event timer | Start = | End = | Message = | End message = | Future message = | Today = }}
The template doesn't work in real time, but receives the current day from the server when a new cache is loaded. As such, the template is prone to "getting stuck". If that happens, you can purge the cache. Consider including the Template:Purge in your message for user convenience.
Parameters
All parameters are optional.
Start is for the start date and End is for the end date. If start date is omitted, the message will be shown until the end date from the beginning of the year. If end date is omitted, the message will be shown until the end of the year. If both are omitted, the message will be shown around the year.
Message is the message you want to show between start and end.
End message is shown after the end date has passed, and Future message is shown before the start date. If either is omitted, no message is shown during those times.
Today is if you, for some reason, want to compare the start date and end date for some specific date. This parameter is recommended only for advanced use.
Dates
The template uses parser function {{#time: }}, which can intepret several different date formats. At least the following formats work in the template:
Format | Example |
---|---|
Recommended | |
Day number + Month name | 9 October |
Month name + Day number | October 9 |
Day number + Month Abbr. | 9 Oct |
Month Abbr. + Day number | Oct 9 |
Month/Day (US style) | 10/9 |
Other | |
Month[note 1] | Oct October |
ISO[note 2] | 2023-10-09 |
Weekdays[note 3] | Tue Tuesday |
- ↑ Do not include the year when using only the name of the month.
- ↑ Including the year is mandatory, even if it's ignored. The year can be any year.
- ↑ Will find the next weekday given! As such, the value "Wednesday" will refer to Wednesday this week on Monday, Tuesday and Wednesday, but to the next week's Wednesday on all the other days.
Examples
Basic use
{{Event timer | Start = 23 Sept | End = 22 Dec | Message = '''It's autumn in the Northern Hemisphere on Earth accoring to the astronomical definition.''' | End message = '''Autumn has passed.''' | Future message = '''There's still time until autumn.'''}}
Let's assume today is 10th October, which is between 23rd September and 22 December. Now, the template will render like this:
It's autumn in the Northern Hemisphere on Earth accoring to the astronomical definition.
If it was 4th July, before those dates, instead, we'd have the following render instead:
There's still time until autumn.
And, if it was 25th December, after those dates, this is what we would get:
It's autumn in the Northern Hemisphere on Earth accoring to the astronomical definition.
Omitting end and future messages
We don't have to show anything before or after the selected dates.
{{Event timer | Start = 23 Sept | End = 22 Dec | Message = '''It's autumn in the Northern Hemisphere on Earth accoring to the astronomical definition.'''}}
So, on 10th October we will see this:
It's autumn in the Northern Hemisphere on Earth accoring to the astronomical definition.
But if on 4th July and 25th December, we will see nothing.
Single-day
{{Event timer | Start = 26 Oct | End = 26 Oct | Message = '''Happy birthday, [[Jovenan]]!''' | End message = '''Jovenan's birthday has passed.''' | Future message = '''It's not yet Jovenan's birthday'''}}
On 26th October, we will have the following:
Happy birthday, Jovenan!
Otherwise, we will have either of these:
It's not yet Jovenan's birthday
Jovenan's birthday has passed.
Styling
{{Event timer | Start = 26 Oct | End = 26 Oct | Message = <div style="width: 80%; margin:auto; text-align: center; border: 3px double blue; background-color: lightsteelblue; font-size: 20px">Happy birthday, Jovenan!</div>}}
On 26th October, we will see this: