Extension:DateDiff

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
DateDiff

Release status: beta

Implementation Parser function
Description Takes two dates and returns all intermediary days.
Author(s) Kwisatz,
Jeroen De Dauw
Latest version 0.1.1 (2010-09-13)
MediaWiki 1.15+
Database changes No
License Creative Commons Attribution Share Alike 3.0
Download
Hooks used
ParserFirstCallInit

Translate the DateDiff extension if it is available at translatewiki.net

Check usage and version matrix; code metrics

The DateDiff extension adds a 'dates' parser function that returns a list of intermediary days.

Usage[edit | edit source]

A typical use case are events in a semantic setup that span multiple days. In order to have the events appear on all days on a calendar provided by the Semantic Result Formats extension, you would use something like:

{{#ifeq: {{{recurring}}} | no | {{#arraymap: {{#dates: | StartDate={{{from}}} | EndDate={{{till}}} }}|,|@@@@|[[Has date::@@@@| ]]| }} }}

Number of days between two days (requires Extension:Arrays extension):

{{#arraydefine:days|{{#dates: | StartDate=2015-04-01 | EndDate=2015-04-10 }}}}
{{#arraysize:days}}

Installation[edit | edit source]

  • Download and place the file(s) in a directory called DateDiff in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
require_once "$IP/extensions/DateDiff/DateDiff.php";
  • YesYDone - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.