lib/date.js
function getWeekYear(d, localeCode, iso) {
  var year, month, firstDayOfWeek, firstDayOfWeekYear, week, loc;
  year = getYear(d);
  month = getMonth(d);
  if (month === 0 || month === 11) {
    if (!iso) {
      loc = localeManager.get(localeCode);
      firstDayOfWeek = loc.getFirstDayOfWeek(localeCode);
      firstDayOfWeekYear = loc.getFirstDayOfWeekYear(localeCode);
    }
    week = getWeekNumber(d, false, firstDayOfWeek, firstDayOfWeekYear);
    if (month === 0 && week === 0) {
      year -= 1;
    } else if (month === 11 && week === 1) {
      year += 1;
    }
  }
  return year;
}
function getWeekYear(d, localeCode, iso) {
  var year, month, firstDayOfWeek, firstDayOfWeekYear, week, loc;
  year = getYear(d);
  month = getMonth(d);
  if (month === 0 || month === 11) {
    if (!iso) {
      loc = localeManager.get(localeCode);
      firstDayOfWeek = loc.getFirstDayOfWeek(localeCode);
      firstDayOfWeekYear = loc.getFirstDayOfWeekYear(localeCode);
    }
    week = getWeekNumber(d, false, firstDayOfWeek, firstDayOfWeekYear);
    if (month === 0 && week === 0) {
      year -= 1;
    } else if (month === 11 && week === 1) {
      year += 1;
    }
  }
  return year;
}
function getWeekYear ( d , localeCode , iso ) { var year , month , firstDayOfWeek , firstDayOfWeekYear , week , loc ; year = getYear ( d ) ; month = getMonth ( d ) ; if ( month === 0 || month === 11 ) { if ( ! iso ) { loc = localeManager . get ( localeCode ) ; firstDayOfWeek = loc . getFirstDayOfWeek ( localeCode ) ; firstDayOfWeekYear = loc . getFirstDayOfWeekYear ( localeCode ) ; } week = getWeekNumber ( d , false , firstDayOfWeek , firstDayOfWeekYear ) ; if ( month === 0 && week === 0 ) { year -= 1 ; } else if ( month === 11 && week === 1 ) { year += 1 ; } } return year ; }
Week year helpers
Week year helpers