Jump to content

Template:Start date: Difference between revisions

From RetroTechCollection
No edit summary
No edit summary
ย 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- =======================================================================
<!-- =========================================================
Template:Start date
ย  ย  Template:Start date โ€”ย  returns an inline, non-wrapping
Inline (no box) ISO-compatible date with micro-formatting for machine reading
ย  ย  โ€œMonth day, Yearโ€ string (e.g. โ€œDecember 12, 1991โ€)
======================================================================= -->
============================================================= -->
<includeonly>
<includeonly><span class="nowrap">{{#time:F j, Y|{{{1}}}-{{{2|1}}}-{{{3|1}}}}}</span></includeonly><noinclude>
<span class="dtstart" title="{{#time:Y-m-d|{{{1}}}-{{{2|01}}}-{{{3|01}}}}}">
{{#time:F&nbsp;j, Y|{{{1}}}-{{{2|1}}}-{{{3|1}}}}}
</span>
</includeonly><noinclude>
== Usage ==
== Usage ==
<syntaxhighlight lang="text">
* `{{Start date|1991|12|12}}` โ†’ '''December 12, 1991'''
{{Start date|YYYY|MM|DD}}
* `{{Start date|1992|10|15}}` โ†’ '''October 15, 1992'''
</syntaxhighlight>
* You may omit the day or month: `{{Start date|1993|05}}` โ†’ '''May 1993'''
* '''YYYY''' โ€“ 4-digit year (required)ย 
* '''MM''' โ€“ 1- or 2-digit month (optional; defaults to 1)ย 
* '''DD''' โ€“ 1- or 2-digit dayย  (optional; defaults to 1)


The template renders an **inline** date like โ€œ''April 21, 1994''โ€ while the
The template purposely contains **no leading / trailing spaces** or newlines so it can be
`title` attribute supplies an ISO-8601 machine-readable form (`1994-04-21`)
embedded inside tables (e.g. infobox cells) without triggering unwanted
for Microformats (h-event โ†’ <span class="dtstart">).
paragraph (`<p>`) or preformatted (`<pre>`) blocks.


=== Examples ===
The `nowrap` class (MediaWiki core) keeps the entire date on a single
; Specific day
line, avoiding ugly breaks inside infoboxes.ย 
:<code><nowiki>{{Start date|1991|11|21}}</nowiki></code> โ†’ {{Start date|1991|11|21}}
; Month & year only
:<code><nowiki>{{Start date|1988|10}}</nowiki></code> โ†’ {{Start date|1988|10}}
; Year only
:<code><nowiki>{{Start date|1978}}</nowiki></code> โ†’ {{Start date|1978}}
ย 
[[Category:Date formatting templates]]
</noinclude>
</noinclude>

Latest revision as of 12:17, 27 April 2025


  • `

December 12, 1991` โ†’ December 12, 1991

  • `

October 15, 1992` โ†’ October 15, 1992

  • You may omit the day or month: `

May 1, 1993` โ†’ May 1993

The template purposely contains **no leading / trailing spaces** or newlines so it can be embedded inside tables (e.g. infobox cells) without triggering unwanted

paragraph (`

`) or preformatted (`

`) blocks.

The `nowrap` class (MediaWiki core) keeps the entire date on a single
line, avoiding ugly breaks inside infoboxes.