}

  // -----------------------------------------------------------------------
  @Override
  public DateTimeValueRange range(DateTimeField field) {

    if (field instanceof ChronoField) {
      ChronoField f = (ChronoField) field;
      if (f.isDateField()) {
        switch (f) {
          case DAY_OF_MONTH:
            return DateTimeValueRange.of(1, lengthOfMonth());
          case DAY_OF_YEAR:
            return DateTimeValueRange.of(1, lengthOfYear());
          case ALIGNED_WEEK_OF_MONTH:
            return DateTimeValueRange.of(1, getMonth() == Month.FEBRUARY && isLeapYear() == false ? 4 : 5);
          case YEAR_OF_ERA:
            return (getYear() <= 0 ? DateTimeValueRange.of(1, MAX_YEAR + 1) : DateTimeValueRange.of(1, MAX_YEAR));
        }
        return field.range();
      }
      throw new DateTimeException("Unsupported field: " + field.getName());
    }