Template:Event timer/doc

From 118Wiki
< Template:Event timer
Revision as of 13:13, 10 October 2023 by Jovenan (talk | contribs) (date formats, note on cache purging. wip)
Jump to navigation Jump to search
Note: This template is currently under construction.
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 = }}
NOTE!
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
  1. Do not include the year when using only the name of the month.
  2. Including the year is mandatory, even if it's ignored. The year can be any year.
  3. 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:

Happy birthday, Jovenan!