public/javascripts/yui/calendar/calendar.js
function (dt, startOfWeek) {
        startOfWeek = startOfWeek || 0;
        var dayOfWeekIndex = dt.getDay(),
            dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;

        return this.subtract(dt, this.DAY, dayOfWeek);
    }
function (dt, startOfWeek) {
        startOfWeek = startOfWeek || 0;
        var dayOfWeekIndex = dt.getDay(),
            dayOfWeek = (dayOfWeekIndex - startOfWeek + 7) % 7;

        return this.subtract(dt, this.DAY, dayOfWeek);
    }
function ( dt , startOfWeek ) { startOfWeek = startOfWeek || 0 ; var dayOfWeekIndex = dt . getDay ( ) , dayOfWeek = ( dayOfWeekIndex - startOfWeek + 7 ) % 7 ; return this . subtract ( dt , this . DAY , dayOfWeek ) ; }
Get the first day of the week, for the give date.
@param {Date} dt The date in the week for which the first day is required.
@param {Number} startOfWeek The index for the first day of the week, 0 = Sun, 1 = Mon ... 6 = Sat (defaults to 0)
@return {Date} The first day of the week
Get the first day of the week for the give date .