1127N/A<div id="demo" class="yui3-skin-sam">
1127N/A <div id="mycalendar"></div>
1127N/AYUI().use('calendar', 'datatype-date', 'datatype-date-math', function(Y) {
1127N/A // Switch the calendar main template to the included two pane template
1127N/A // Create a new instance of calendar, setting the showing of previous
1127N/A // and next month's dates to true, and the selection mode to multiple
1127N/A // selected dates. Additionally, set the disabledDatesRule to a name of
1127N/A // the rule which, when matched, will force the date to be excluded
1127N/A // from being selected. Also configure the initial date on the calendar
1416N/A disabledDatesRule: "tuesdays_and_fridays",
1127N/A// Create a set of rules to match specific dates. In this case,
1127N/A// the "tuesdays_and_fridays" rule will match any Tuesday or Friday,
1127N/A// whereas the "all_weekends" rule will match any Saturday or Sunday.
1416N/A "2,5": "tuesdays_and_fridays",
1127N/A// Set the calendar customRenderer, provides the rules defined above,
1127N/A// as well as a filter function. The filter function receives a reference
1127N/A// to the node corresponding to the DOM element of the date that matched
1127N/A// one or more rule, along with the list of rules. Check if one of the
1127N/A// rules is "all_weekends", and if so, apply a custom CSS class to the
1127N/A filterFunction: function (date, node, rules) {
1127N/A// Set a custom header renderer with a callback function,
1127N/A// which receives the current date and outputs a string.
1127N/A// date, so both months can appear in the header (since
1127N/A// this is a two-pane calendar).
1127N/A// When selection changes, output the fired event to the
1127N/A// console. the newSelection attribute in the event facade
1127N/A// will contain the list of currently selected dates (or be
1127N/A// empty if all dates have been deselected).