code: function (field) {
              if (MAX_VALUES[field] !== undefined) {
                  return MAX_VALUES[field];
              }
              var value, fields = this.fields;
              switch (field) {
              case DAY_OF_MONTH:
                  value = getMonthLength(fields[YEAR], fields[MONTH]);
                  break;
              case WEEK_OF_YEAR:
                  var endOfYear = new GregorianCalendar(fields[YEAR], GregorianCalendar.DECEMBER, 31);
                  value = endOfYear.get(WEEK_OF_YEAR);
                  if (value === 1) {
                      value = 52;
                  }
                  break;
              case WEEK_OF_MONTH:
                  var endOfMonth = new GregorianCalendar(fields[YEAR], fields[MONTH], getMonthLength(fields[YEAR], fields[MONTH]));
                  value = endOfMonth.get(WEEK_OF_MONTH);
                  break;
              case DAY_OF_YEAR:
                  value = getYearLength(fields[YEAR]);
                  break;
              case DAY_OF_WEEK_IN_MONTH:
                  value = toInt((getMonthLength(fields[YEAR], fields[MONTH]) - 1) / 7) + 1;
                  break;
              }
              if (value === undefined) {
                  throw new Error('maximum value not defined!');
              }
              return value;
          }
docs: Returns the maximum value for the given calendar field
  of this GregorianCalendar instance.
  The maximum value is defined as the largest value returned
  by the get method for any possible time value, taking into consideration
  the current values of the getFirstDayOfWeek, getMinimalDaysInFirstWeek methods.
  @param field the calendar field.
  @returns {Number} the maximum value for the given calendar field.