Template:Datetime: Difference between revisions
From Eco - English Wiki
[unchecked revision] | [unchecked revision] |
m (Add help cursor.) |
m (Check for the first parameter too.) |
||
Line 1: | Line 1: | ||
<includeonly>{{#if:{{{2|}}}<!-- | <includeonly>{{#if:{{{2|}}}{{{1|}}}<!-- | ||
-->|<time datetime="{{{1|}}}" title="{{{1|}}}" style="text-decoration:underline dotted 0.0625em;cursor:help;">{{{2}}}</time><!-- | -->|<time datetime="{{{1|}}}" title="{{{1|}}}" style="text-decoration:underline dotted 0.0625em;cursor:help;">{{{2}}}</time><!-- | ||
-->|<time datetime="{{{1 | -->|{{#if:{{{1|}}}|<time datetime="{{{1}}}">{{{1}}}</time>|<span style="color:red">ERROR: No value given to datetime template!</span>}}|<!-- | ||
-->}}</includeonly><noinclude> | -->}}</includeonly><noinclude> | ||
{{doc}}</noinclude> | {{doc}}</noinclude> |
Revision as of 14:55, 26 February 2022
Add the "time" HTML element around a date, time, or date & time text for better search engine results and to help people using accessibility technologies.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Datetime | 1 | String with a date, time, or date and time.
| String | required |
Display text | 2 | Text to display instead of the date or time.
| String | optional |
Please refer to the <time>: The (Date) Time element on MDN Web Docs for the exact specification of the datetime string and more examples.
Usage
Examples
Code | Result |
---|---|
{{Datetime|2022-01-02}} |
|
{{Datetime|2022-02-01|On February 1st}} |
|
{{Datetime|12:30|half past noon}} |
|
{{Datetime|2022-01-01T00:00:01}} |
|
{{Datetime}} |
ERROR: No value given to datetime template! |