Jump to content

Module:Date period/doc: Difference between revisions

From Humanipedia
hp>Nickps
 
m 1 revision imported
 
(No difference)

Latest revision as of 21:10, 3 February 2025

Usage[edit source]

For templates, you might want to use {{Date period}} instead.

{{#invoke:Date period|_main|dateA|dateB}}

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.

Date A Date B Output
2021-02-19 present Lua error in package.lua at line 80: module 'Module:Yesno' not found.
present 2021-02-25 Lua error in package.lua at line 80: module 'Module:Yesno' not found.
2021-02-19 2021-02-25 Lua error in package.lua at line 80: module 'Module:Yesno' not found.
2021-02-19 2021-03-25 Lua error in package.lua at line 80: module 'Module:Yesno' not found.
2020-02-19 2021-02-25 Lua error in package.lua at line 80: module 'Module:Yesno' not found.

The year can be forcefully shown with the force-year parameter (third parameter of p._main).

Date A Date B force-year Output
2021-02-19 2021-02-25 no Lua error in package.lua at line 80: module 'Module:Yesno' not found.
2021-02-19 2021-02-25 yes Lua error in package.lua at line 80: module 'Module:Yesno' not found.
2020-02-19 2021-02-25 no Lua error in package.lua at line 80: module 'Module:Yesno' not found.
2020-02-19 2021-02-25 yes Lua error in package.lua at line 80: module 'Module:Yesno' not found.

If one of the dates is invalid, the raw text will be displayed instead.

Date A Date B Output
2021-02-19 Sometime far in the future. Lua error in package.lua at line 80: module 'Module:Yesno' not found.
Long ago 2021-02-25 Lua error in package.lua at line 80: module 'Module:Yesno' not found.