Extension:Semantic Result Formats/calendar format

The result format calendar, part of the Semantic Result Formats extension, displays results in a monthly calendar in which a user can scroll forward and backward through time. Its output matches that of the now-obsolete Semantic Calendar extension.

Usage
A query in calendar format should be called in the following way:

...in other words, the date property being queried against should also be used to filter dates: #calendarstartdate and #calendarenddate will return the first and last date (actually, the day after the last date), respectively, for any specific month. This is done so that only those dates that are within the current month, instead of all of them, are passed in to be displayed by the calendar.

Some notes on creating such queries:
 * Make sure to include the colon, ':', in the #calendarstartdate and #calendarenddate parser function calls; otherwise, they won't work.
 * Don't worry that the comparison operators are '<' and '>' instead of '<=' and '>='; the return values of the parser functions are set so that this will not be an issue
 * You can also add a "sort=" parameter, like "sort=Has date", so that events within each day will be sorted according to the time they take place (assuming the "Has date" property in this case also includes a time value.)

Display options
You can set the color the entries are marked with by adding the color option in the query: |color=red

Different colors for each set of events can be displayed by using Semantic Compound Queries.

The option template =  , can be used to alter the display of a calendar item/event display: |format=calendar |template= <...> For more information about the template used, see semantic-mediawiki.org

As of SRF 1.6, you can also set the day of the week on which weeks begin (by default it's Sunday), across the entire wiki, by setting the variable $srfgFirstDayOfWeek in LocalSettings.php, after the inclusion of Semantic Result Formats. To change it to Monday, for instance, you would add the following, if using an English-language wiki: Note that the day has to be set in the language of the wiki.

The caching issue
For previous versions of Semantic Result Formats, calendars did not display correctly unless MediaWiki caching was manually disabled on at least those pages that contained calendars. This has now been fixed in the code; if it's still a problem for you, please upgrade to the latest version of SRF.

Changing the results limit
The default limit of results displayed by an inline query is 50. If you have more than 50 events in any month, you should add a 'limit=' parameter to the query, with a number greater than the maximum number you have. An example is:

If the number of events you have in any month is greater than 500, though, you will need to take a second step - add the following line to your LocalSettings.php file, after the inclusion of Semantic MediaWiki: $smwgQMaxInlineLimit = 1000; (The value can be any number greater than the maximum number of events you have per month.)

Example
You can see an example of the calendar format in use on this calendar page on Discourse DB.