Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Date period/doc
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Module rating|beta}} <!-- Please place categories where indicated at the bottom of this page and interwikis at Wikidata (see [[Wikipedia:Wikidata]]) --> == Usage == :''For templates, you might want to use {{T|Date period}} instead.'' <code><nowiki>{{</nowiki>#invoke:{{BASEPAGENAME}}|''_main''|dateA|dateB}}</code> Automatically formats two given dates with a space and and en dash. Dates can be of any format supported by [[Module:Date]]. If the month is the same, it is only shown once. If the month and day is the same, it will not show a second part at all. If the year is different, it will show the year unless disabled. {| class="wikitable" ! Date A ! Date B ! Output |- | 2021-02-19 | present | {{#invoke:Date period|main|2021-02-19|present}} |- | present | 2021-02-25 | {{#invoke:Date period|main|present|2021-02-25}} |- | 2021-02-19 | 2021-02-25 | {{#invoke:Date period|main|2021-02-19|2021-02-25}} |- | 2021-02-19 | 2021-03-25 | {{#invoke:Date period|main|2021-02-19|2021-03-25}} |- | 2020-02-19 | 2021-02-25 | {{#invoke:Date period|main|2020-02-19|2021-02-25}} |} The year can be forcefully shown with the <code>force-year</code> parameter (third parameter of <code>p._main</code>). {| class="wikitable" ! Date A ! Date B ! force-year ! Output |- | 2021-02-19 | 2021-02-25 | no | {{#invoke:Date period|main|2021-02-19|2021-02-25|force-year=no}} |- | 2021-02-19 | 2021-02-25 | yes | {{#invoke:Date period|main|2021-02-19|2021-02-25|force-year=yes}} |- | 2020-02-19 | 2021-02-25 | no | {{#invoke:Date period|main|2020-02-19|2021-02-25|force-year=no}} |- | 2020-02-19 | 2021-02-25 | yes | {{#invoke:Date period|main|2020-02-19|2021-02-25|force-year=yes}} |} If one of the dates is invalid, the raw text will be displayed instead. {| class="wikitable" ! Date A ! Date B ! Output |- | 2021-02-19 | Sometime far in the future. | {{#invoke:Date period|main|2021-02-19|Sometime far in the future.}} |- | Long ago | 2021-02-25 | {{#invoke:Date period|main|Long ago|2021-02-25}} |} <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | <!-- Categories below this line, please; interwikis at Wikidata --> }}</includeonly>
Summary:
Please note that all contributions to Stockhub may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Module rating
(
edit
)
Template:T
(
edit
)
Module:Date
(
edit
)
Module:Date period
(
edit
)
Module:Yesno
(
edit
)