Changes

Jump to navigation Jump to search
known issues
{{Documentation subpage}}
<!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) -->
This template creates a date range with non-breaking spaces between the month and day, and {{tl|spaced ndash}}.
== Usage ==
'''<nowiki>{{daterangedash|</nowiki>'''''Starting date'''''|'''''Ending date'''''|'''''Date format string'''''<nowiki>}}</nowiki>'''

Both date values can be in any format accepted by PHP's [http://www.php.net/manual/en/function.strtotime.php strtotime()] function.
* ''Starting date'' is the starting date for the range.
* ''Ending Date'' is the ending date for the range.
* ''Date format string'' is one of the following:
** <code>dm</code>: day month (1 January)
** <code>dmy</code>: day month year (1 January 1900)
** <code>md</code>: month day (January 1)
** <code>mdy</code>: month day year (January 1, 1900) – note: a comma will be inserted

If both start and end dates are in the same year, the first year will be omitted. There is no error checking to ensure the start date occurs before the end date.

==Known issues==
Because this makes use of the [[mw:Help:Extension:ParserFunctions##time|#time parser function]], it is subject to the function's limitations. For example, it only works for dates between 1 January 111 and 31 December 9999. Furthermore, three-digit years will be displayed with a leading zero: <code>0111</code>, not <code>111</code>.

==Examples==
{|class="wikitable"
!Description
!Template code
!Wikicode equivalent
!Rendered output
|-
| Date and month only
| <nowiki>{{daterangedash|2012-01-10|2012-02-28|dm}}</nowiki>
| <nowiki>{{nowrap|10 January}}{{spaced ndash}}{{nowrap|28 February}}</nowiki>
| {{daterangedash|2012-01-10|2012-02-28|dm}}
|-
| Date month year
| <nowiki>{{daterangedash|January 1 1999|August 5|dmy}}</nowiki>
| <nowiki>{{nowrap|1 January}} 1999{{spaced ndash}}{{nowrap|5 August}} </nowiki>{{CURRENTYEAR}}
| {{daterangedash|January 1 1999|August 5|dmy}}
|-
| Month day only
| <nowiki>{{daterangedash|September 11|September 15|md}}</nowiki>
| <nowiki>{{nowrap|September 11}}{{spaced ndash}}{{nowrap|September 15}}</nowiki>
| {{daterangedash|September 11|September 15|md}}
|-
| Month day year, both dates in same year
| <nowiki>{{daterangedash|April 20 2015|May 14 2015|dmy}}</nowiki>
| <nowiki>{{nowrap|April 20}}{{spaced ndash}}{{nowrap|May 14,}} </nowiki>2015
| {{daterangedash|April 20 2015|May 14 2015|mdy}}
|-
|}

==See also==
* {{tl|daterange}}
<includeonly>
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Time, date and calendar templates]]
</includeonly>
Anonymous user

Navigation menu