टेम्पलेट:Time ago/doc: रिवीजन सभ के बीचा में अंतर

Content deleted Content added
छो ३ revisions imported from hi:साँचा:Time_ago/doc
updated from enwiki
लाइन 1:
{{Documentation subpage}}
{{high-use}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{lua|Module:TimeAgo}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
 
The '''Time ago''' template calculates the amount of time which has passed since a provided timestamp. The result is a string similar to one of the examples below. This template ''should not'' be used with "subst" unless you don't want the stamp to change as the user refreshes the page.
 
Note that due to Wikipedia's caching mechanisms, you may need to [[WP:PURGE|purge]] a page using this template to update the dynamic value. See the section [[#Purge|Purge]] below.
 
The result is rounded down. "Month" is defined as 31 days.
'''नोट:महीनों के हिंदी नाम या हिंदी अंक प्रयोग करने पर यह साँचा एक्सप्रेशन एरर देता है ([[:bugzilla:19412|bug 19412]])'''
 
== Usage ==
उदाहरण: <nowiki>{{time ago| 4 नवम्बर 2008}}</nowiki> देता है {{time ago| 4 नवम्बर 2008}}
 
=== Usage ===
* <code><nowiki>{{</nowiki>'''Time ago'''|''timestamp''<nowiki>}}</nowiki></code>
 
The timestamp can be almost any solid, readable format but to avoid ambiguity mistakes, one of the styles below is preferred.
 
* <code>magnitude</code> parameter can be set to explicitly use certain unit. Allowed values are: <code>seconds</code>, <code>minutes</code>, <code>hours</code>, <code>days</code>, <code>weeks</code>, <code>months</code> and <code>years</code>.
=== Examples ===
* <code>min_magnitude</code> parameter can be set to use the specified unit or bigger units. Allowed values are: <code>seconds</code>, <code>minutes</code>, <code>hours</code>, <code>days</code>, <code>months</code> and <code>years</code>.
* <tt><nowiki>{{Time ago| -83 minutes}}</nowiki></tt> → '''{{Time ago|-83 minutes}}'''
* <code>ago</code> parameter can be set to override the default usage of the text "<code>ago</code>". If the parameter is blank but not missing (i.e. <code><nowiki>{{time ago|2008|ago=}}</nowiki></code>), then the text "ago" is suppressed altogether. For future dates, setting "ago" as blank but not missing will suppress the text "time" (i.e. "2 years" instead of "2 years' time").
* <tt><nowiki>{{Time ago| -334 minutes}}</nowiki></tt> → '''{{Time ago|-334 minutes}}'''
 
* <tt><nowiki>{{Time ago|{{REVISIONTIMESTAMP}}}}</nowiki></tt> → '''{{Time ago|{{REVISIONTIMESTAMP}}}}'''
=== Spelling out numbers ===
* <tt><nowiki>{{Time ago| Jan 21, 2001 3:45 PM}}</nowiki></tt> → '''{{Time ago|Jan 21 2001 3:45 PM}}'''
Numbers from 1 to 100 can be spelled out in their equivalent English word by using the <code>spellout</code> parameter. If <code>spellout</code> is set to "yes", "y", "true" or "1", all numbers from 1 to 100 will be spelled out. If <code>spellout</code> is set to "auto", only numbers from 1 to 9 will be spelled out, as per the recommendations at [[MOS:NUMERAL]].
* <tt><nowiki>{{Time ago| Nov 6 2008}}</nowiki></tt> → '''{{Time ago|Nov 6 2008 }}'''
 
It is also possible to set a custom maximum value for spelling out by using the <code>spelloutmax</code> parameter. For example, setting {{para|spellout|yes}} and {{para|spelloutmax|24}} will result in all numbers less than or equal to 24 being spelled out, and all numbers greater than 24 appearing as numerals.
 
=== Purge link ===
Add the parameter {{para|purge|yes}} to add a [[WP:PURGE|purge]] link.
 
== Examples ==
* {{tlc|Time ago| -83 minutes}} → '''{{Time ago|-83 minutes}}'''
* {{tlc|Time ago| -334 minutes}} → '''{{Time ago|-334 minutes}}'''
* {{tlc|Time ago| +334 minutes}} → '''{{Time ago|+334 minutes}}'''
* {{tlc|Time ago|<nowiki>{{REVISIONTIMESTAMP}}</nowiki>}} → '''{{Time ago|{{REVISIONTIMESTAMP}}}}'''
* {{tlc|Time ago| Jan 21, 2001 3:45 PM}} → '''{{Time ago|Jan 21 2001 3:45 PM}}'''
* {{tlc|Time ago| 3:45 pm, 21 Jan 2001}} → '''{{Time ago|3:45 pm, 21 Jan 2001}}'''
* {{tlc|Time ago| Nov 6 2008}} → '''{{Time ago|Nov 6 2008}}'''
* {{tlc|Time ago| Nov 6 2008|3=magnitude=weeks}} → '''{{Time ago| Nov 6 2008|magnitude=weeks}}'''
* {{tlc|Time ago| Nov 6 2008|3=min_magnitude=days}} → '''{{Time ago|Nov 6 2008|min_magnitude=days}}'''
* {{tlc|Time ago| Nov 6 2008|3=min_magnitude=years}} → '''{{Time ago|Nov 6 2008|min_magnitude=years}}'''
* {{tlc|Time ago| Nov 6 2008|3=ago=in the past}} → '''{{Time ago|Nov 6 2008|ago=in the past}}'''
* {{tlc|Time ago| Nov 6 2008|3=purge=yes}} → '''{{Time ago|Nov 6 2008|purge=yes}}'''
* {{tlc|Time ago| 2008-11-06}} → '''{{Time ago|2008-11-06}}'''
* <code><nowiki>{{Time ago| June 1, 2009|spellout=yes}}</nowiki></code> &rarr; '''{{time ago/sandbox|June 1, 2009|spellout=yes}}'''
* <code><nowiki>{{Time ago| June 1, 1999|spellout=yes}}</nowiki></code> &rarr; '''{{time ago/sandbox|June 1, 1999|spellout=yes}}'''
* <code><nowiki>{{Time ago| June 1, 2009|spellout=auto}}</nowiki></code> &rarr; '''{{time ago/sandbox|June 1, 2009|spellout=auto}}'''
* <code><nowiki>{{Time ago| June 1, 1999|spellout=auto}}</nowiki></code> &rarr; '''{{time ago/sandbox|June 1, 1999|spellout=auto}}'''
* <code><nowiki>{{Time ago| June 1, 1989|spellout=yes|spelloutmax=15}}</nowiki></code> &rarr; '''{{time ago/sandbox|June 1, 1989|spellout=yes|spelloutmax=15}}'''
* <code><nowiki>{{Time ago| June 1, 1989|spellout=yes|spelloutmax=25}}</nowiki></code> &rarr; '''{{time ago/sandbox|June 1, 1989|spellout=yes|spelloutmax=25}}'''
 
=== SeeTemplateData also ===
{{TemplateDataHeader}}
* [[Template:LastEditedBy]]
<templatedata>
{
"description": "This template calculates the amount of time which has passed since a provided timestamp.",
"params": {
"1": {
"label": "Timestamp",
"description": "Base timestamp for calculation of passed time. Example format: Nov 6 2008, see template documentation for other supported formats.",
"type": "string",
"required": true
},
"magnitude": {
"label": "magnitude",
"description": "Explicitly sets a specific unit to display return value. Allowed values are: seconds, minutes, hours, days, weeks, months and years.",
"type": "string",
"required": false
},
"min_magnitude": {
"label": "min_magnitude",
"description": "Sets a minimum unit to display return value. Allowed values are: seconds, minutes, hours, days, months and years.",
"type": "string",
"required": false
},
"ago": {
"label": "ago",
"description": "Override the default usage of the text 'ago'. If it is blank but not missing then 'ago' will be removed completely; for future dates, this will remove the text 'time' as well.",
"type": "string",
"required": false
},
"purge": {
"label": "Purge link",
"description": "Add the parameter purge=yes to add a WP:PURGE link.",
"type": "string",
"required": false
},
"spellout": {
"type": "string/line",
"label": "Spell out numbers",
"description": "If set to \"yes\", \"y\", \"true\" or \"1\", numbers from 1 to 100 are spelled out as English words. If set to \"auto\", numbers from 1 to 9 are spelled out."
},
"spelloutmax": {
"type": "number",
"label": "Spell out max",
"description": "The maximum number to be spelled out as an English word."
}
}
}
</templatedata>
 
== See also ==
* {{tl|Last edited by}}
* {{tl|Years or months ago}}
* {{tl|Age}}
* {{tl|Start date and age}}
* {{tl|Birth date and age}}
<includeonly>
<!-- Categories go here and interwikis go in Wikidata -->
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Mathematical time and date function templates]]
[[id:Templat:Time ago]]
[[hy:Կաղապար:Time ago]]
[[uk:Шаблон:Time ago]]
</includeonly>