Scal Methods

Public Methods

setCurrentDate(string or date object)

Description:

This method changes the current date and redraws the calendar. By default, will execute the update callback.

Required Parameters:

This methods required parameter can be a String or a Date object.
If the parameter is a date object, the current date will be set to new the parameter date.

As a String, the allowed paramater values are:

Optional Parameters:

This method accepts a second optional parameter. When passed as boolean true, this method will not execute the update callback.

Return Values:

This method returns the modified current date.

var options = ({
     month:11,
     year:2009,
     day: 1
});
var Cal = new scal('samplecal',updateelement,options);
Cal.setCurrentDate('monthup'); // Changes the current date from 11-01-2009 to 12-01-2009
Cal.setCurrentDate('yearup'); // Changes the the current date from 12-01-2009 12-01-2010
Cal.setCurrentDate('init'); // Changes the current date to the original date: 11-01-2009
Cal.setCurrentDate('monthdown'); // Changes the current date from 11-01-2009 to 10-01-2009
Cal.setCurrentDate('yeardown'); // Changes the current date from 10-01-2009 to 10-01-2008
var d = new Date(2007,10,1);
Cal.setCurrentDate(d); // Changes the current date to 11-01-2007

destroy()

Description:

Stops event observations related to scal, obliterates the scal instance, removes elements created by scal, and generally frees up memory.

Parameters:

None

Return Values:

None

Cal.destroy();

toggleCalendar()

Description:

If the calendar is visible, calling this function makes it invisible. Amazingly, the reverse is also true.

Parameters:

None

Return Values:

None

Cal.toggleCalendar();

getElementByDate(date object)

Description:

Retrieves the calendar day element for the specified date.

Parameters:

Date object of the the specified element to retrieve.

Return Values:

The calendar element for the specified date.

var dayElement = Cal.getElementByDate(new Date('December 12, 2008'));

getElementsByWeek(week number)

Description:

Retrieves the calendar day elements for the specified week.

Parameters:

Number of the week to retrieve elements for.

Return Values:

Array of calendar day elements for the specified week.

var weekElements = Cal.getElementsByWeek(1);

getSelectedElement()

Description:

Retrieves the selected day for the current calendar.

Parameters:

None

Return Values:

The calendar element for the selected day.

var selected = Cal.getSelectedElement();

getTodaysElement()

Description:

Retrieves the today element for the current calendar.

Parameters:

None

Return Values:

The calendar element for today's element.

var today = Cal.getTodaysElement();

getDateByElement(element object)

Description:

Retrieves the date object for the specified calendar day element.

Parameters:

Extended element in the current calendar view.

Return Values:

Date object for the specified element.

var dayTwo = Cal.getDateByElement(weekElements[1]);

Depreciated Methods

openCalendar()

Description:

Displays the calendar.

Parameters:

None

Return Values:

None

closeCalendar()

Description:

Hides the calendar.

Parameters:

None

Return Values:

None

isOpen()

Description:

Returns boolean indicating the display status of the calendar.

Parameters:

None

Return Values:

true/false