Template:Due date

From FlightGear wiki
Jump to navigation Jump to search


The following template description is not displayed when the template is inserted in an article.

Goal

This template can be used when you want to show one text before a certain date and time and another text after that date and time.

Usage

{{due date|due|before|after |date=}}

All parameters are optional.

due
Due date and time. Defaults to 1 January 1970, 00:00:00 UTC
before
Wiki text to be shown before due date.
after
Wiki text to be shown after the due date.
date
Overrides the current date and time. Useful for debugging purposes etc.

Examples

{{due date|Friday, 3 February 2023|A fix is due next Friday.|Should be fixed by now.}}

A fix is due next Friday.

{{due date|21 December 2012|The end is nigh.|The end... was nigh?}}

The end... was nigh?

{{due date|24 December||It is always Christmas day in Santa's workshop.|date=25 December}}

It is always Christmas day in Santa's workshop.

Known issues

Passing parameters with an empty default value

When passing parameters with an empty default value to the template the template will show the before wikitext if the default is not overridden. To fix this instead use yesterday as the default value. See example below:

{{due date|{{{parameter|yesterday}}}|before|after}}

Technical details

This template uses the MediaWiki extension ParserFunctions and specifically the #time: function. The date or time can be in one of the many PHP strtotime() formats, which also includes relative time formats.

Note Dates are less ambiguous if the year is given with four digits and the month is given with letters.

Related templates