src/constraint/weekofyear.js
function(d, val) {
    var wyThur = later.dw.next(later.wy.start(d), 5),
        year = later.date.prevRollover(wyThur, val, later.wy, later.Y);

    // handle case where 1st of year is last week of previous month
    if(later.wy.val(year) !== 1) {
      year = later.dw.next(year, 2);
    }

    var wyMax = later.wy.extent(year)[1],
        wyEnd = later.wy.end(year);

    val = val > wyMax ? wyMax : val || wyMax;

    return later.wy.end(later.date.next(
        later.Y.val(wyEnd),
        later.M.val(wyEnd),
        later.D.val(wyEnd) + 7 * (val-1)
      ));
  }
function(d, val) {
    var wyThur = later.dw.next(later.wy.start(d), 5),
        year = later.date.prevRollover(wyThur, val, later.wy, later.Y);

    // handle case where 1st of year is last week of previous month
    if(later.wy.val(year) !== 1) {
      year = later.dw.next(year, 2);
    }

    var wyMax = later.wy.extent(year)[1],
        wyEnd = later.wy.end(year);

    val = val > wyMax ? wyMax : val || wyMax;

    return later.wy.end(later.date.next(
        later.Y.val(wyEnd),
        later.M.val(wyEnd),
        later.D.val(wyEnd) + 7 * (val-1)
      ));
  }
function ( d , val ) { var wyThur = later . dw . next ( later . wy . start ( d ) , 5 ) , year = later . date . prevRollover ( wyThur , val , later . wy , later . Y ) ; // handle case where 1st of year is last week of previous month if ( later . wy . val ( year ) !== 1 ) { year = later . dw . next ( year , 2 ) ; } var wyMax = later . wy . extent ( year ) [ 1 ] , wyEnd = later . wy . end ( year ) ; val = val > wyMax ? wyMax : val || wyMax ; return later . wy . end ( later . date . next ( later . Y . val ( wyEnd ) , later . M . val ( wyEnd ) , later . D . val ( wyEnd ) + 7 * ( val - 1 ) ) ) ; }
Returns the end of the previous instance of the ISO week value indicated.

@param {Date} d: The starting date
@param {int} val: The desired value, must be within extent
Returns the end of the previous instance of the ISO week value indicated .