Extension:DateDiff

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual - list
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-9-13)
MediaWiki 1.15 or above, possibly older
Database changes no
License CC BY-SA 3.0
Download Template:WikimediaDownload/svn
Hooks used
ParserFirstCallInit

Translate the DateDiff extension if possible

Check usage and version matrix; code metrics

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

Setup[edit | edit source]

Download[edit | edit source]

You can download the code directly via SVN from the MediaWiki source code repository, at http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/DateDiff/. From a command line, you can call the following:

svn checkout http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/DateDiff/

Installation[edit | edit source]

Place the DateDiff directory within the main MediaWiki 'extensions' directory. Then, in the file LocalSettings.php in the main MediaWiki directory, add the following line:

include_once("$IP/extensions/DateDiff/DateDiff.php");

Use cases[edit | edit source]

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

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