By providing a pickPrevNext method among the properties
passed to Calendar.setup(), you may limit keyboard
navigation and prev/next month/year links to "snap" to
only "legal" dates. This is useful for implementing
navigational style calendars such as the calendar popup
(the calendar icon is on the right) at
http://intill.blogspot.com/2005_05_24_intill_archive.html
The pickPrevNext( date, prevP ) method takes a date
object and a direction (prevP==true: moving backwards
in time, prevP!=true: moving forwards in time) in which
to search for the first available "legal" date, and is
expected to return a date to snap to, or null, if none
was available.
This callback will is called whenever the user presses
an arrow (or control+arrow) key (in popup mode) and
when the prev/next month/year buttons are activated.
The date passed to the callback is the date that would
usually have been chosen; for the up arrow, for
instance, the date seven days prior to the present
selection, or for a "previous month" click, the last
date of the month prior to the present.
Assuming this is a legal date, just return it
unchanged. Return null to disallow further movement in
this direction from presently focused date, or return
some other date that will get focused next.
Passing the Boolean value true instead of a function as
the pickPrevNext method will just change the behaviour
of the prev/next month/year buttons to go to the first
available date of the destination month/year, counting
from the point in time you were at previously.
This patch is made against present cvs HEAD, or 2005-08-23.
Adds Calendar.pickNextDate method and pickPrevNext property