Here's the XHTML Facelets code for the tag:
<rich:calendar value="#{oc.overtimeDate}" requiredMessage="Date 1 is required." id="#{oc.overtimeDateId}" isDayEnabled="isDayEnabled" dayStyleClass="getDisabledStyle" datePattern="MM-dd-yyyy" required="#{oc.id == 1 ? true : false}" firstWeekDay="0"/>Note two items: the isDayEnabled and dayStyleClass attributes. Both have their values set via the following JavaScript functions:
<script type="text/javascript"> function isDayEnabled(day){ var date = new Date(day.date); return (date.getDay() == 6); // 6 is Saturday, the only day that should be enabled. } function getDisabledStyle(day){ if (!isDayEnabled(day)) return 'rich-calendar-boundary-dates disabledDay'; } </script>The isDayEnabled() function uses the day argument to get the date and then the day of the week. It returns true if the day of the week is Saturday, false otherwise. This took some trial-and-error, because I didn't know how to get to the day object's date.
The getDisabledStyle() function again receives the day object, which it uses to determine the CSS style class to use. It's returning two classes for that element in this case. The second style is a custom one and is defined here:
<style> .disabledDay{ background-color:gray; } </style>Update: Jerick Osiel asked for help on how to highlight/select a week on the calendar. The answer was thanks to Makhiel on Stackoverflow.com:
<h:outputStylesheet> .highlightWeek { color: red; background-color: black; } </h:outputStylesheet> <h:outputScript> var currentWeekNumber = … // determine current week number chooseDay = function(day) { if (day.weekNumber == currentWeekNumber) return 'highlight'; return ''; } </h:outputScript> <h:form> <rich:calendar dayClassFunction="chooseDay" /> </h:form>