Calendar Action Documentation

This is the documentation page for the calendar action.


See also:
Development: JwCalendar (with source code, and some background and discussion).
This feature is available since:

Short description
Display a calendar face for a specified or the current month. Currently, only years between 1970 and 2037 are supported - earliest timestamp PHP can handle (Windows and some others - to be safe).

{{calendar [year="yyyy"] [month="mm"]}}

yearintegeroptionalcurrent year 4-digit year of the month to be displayed; the default can be overridden by providing a URL parameter 'year'
monthintegeroptionalcurrent month number of month (1 or 2 digits) to be displayed; the default can be overridden by providing a URL parameter 'month'

Long description
Specifying a month and/or year in the action itself results in a "static" calendar face without navigation; conversely, providing no parameters in the action results in a calendar face with navigation links to previous, current and next month, with URL parameters determining which month is shown (with the current month as default).

You can have one "dynamic" (navigable) calendar on a page (multiple ones would just be the same) and any number of "static" calendars.

The current date (if visible) gets a special class to allow a different styling with CSS.

This action was inspired mainly by the "Calendar Menu" code written by Marcus Kazmierczak (© 1998-2002 Astonish Inc.) which we traced back as being the ultimate origin of this code although our starting point was actually a (probably second-hand) variant found on the web which did not contain any attribution.
However, not much of the original code is left in this version. Nevertheless, credit to Marcus Kazmierczak for the original that inspired this, however indirectly: Thanks!

GmBowen (first draft)
JavaWoman (more modifications)



July 2024
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
<< = >>

{{calendar month="12" year="1982"}}

December 1982
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Comment by anonymous
2008-02-19 20:25:39
{{calendar [year="1949"] [month="01"]}} returns the calendar for January, but it appears to be for 2008; NOT 1949
Comment by DarTar
2008-02-21 13:07:17
The reason for this restriction is that 1970-01-01 00:00:00 GMT is the earliest timestamp PHP can handle on some platforms.

On some operating systems when running PHP versions < 5.1, a date like 1956-07-11 makes strtotime return -1, which is an error. Unix timestamps start at the epoch, which is January 1, 1970 (1970-01-01). A '-1' passed along to the date function will get you back December 31, 1969 (at 23:59:59) because you are saying 1 second before midnight of the Unix Epoch. (Note: you may also see the date of 1969-12-31 in a case where you have an empty MySQL date of 0000-00-00, which is very common). This is hugely frustrating, but thankfully is resolved in 5.1.

If you are sure that your system runs on PHP 5.1+ you can change the value of MIN_DATETIME in actions/calendar.php
Comment by NilsLindenberg
2008-02-21 13:10:06
hi anonymous and thanks for your remark. To my astonishment you are right, calender supports only 1970-2038 at the moment. I have opened ticket 667 at the bug-tacker with this bug.
Comment by anonymous
2008-11-23 18:35:46
Although this calendar shows fine, I think it is not much useful because everytime you change month, it reloads the whole page and if it is not on the top of the page, I need to scroll down to make it still visible.
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki