PersianCalendar extends AbstractCalendar { @Override public DateInterval toInterval( DateTimeUnit dateTimeUnit, DateIntervalType type, int offset, int length ) { switch ( type ) { case ISO8601_YEAR: return toYearIsoInterval( dateTimeUnit, offset, length ); case ISO8601_MONTH: return toMonthIsoInterval( dateTimeUnit, offset, length ); case ISO8601_WEEK: return toWeekIsoInterval( dateTimeUnit, offset, length ); case ISO8601_DAY: return toDayIsoInterval( dateTimeUnit, offset, length ); default: return null; } }  static Calendar getInstance(); @Override String name(); @Override DateTimeUnit toIso( DateTimeUnit dateTimeUnit ); @Override DateTimeUnit fromIso( Date date ); @Override DateTimeUnit fromIso( DateTimeUnit dateTimeUnit ); @Override DateInterval toInterval( DateTimeUnit dateTimeUnit, DateIntervalType type, int offset, int length ); @Override int daysInYear( int year ); @Override int daysInMonth( int year, int month ); @Override int weeksInYear( int year ); @Override int isoWeek( DateTimeUnit dateTimeUnit ); @Override int week( DateTimeUnit dateTimeUnit ); @Override int isoWeekday( DateTimeUnit dateTimeUnit ); @Override int weekday( DateTimeUnit dateTimeUnit ); @Override String nameOfMonth( int month ); @Override String shortNameOfMonth( int month ); @Override String nameOfDay( int day ); @Override String shortNameOfDay( int day ); @Override DateTimeUnit minusYears( DateTimeUnit dateTimeUnit, int years ); @Override DateTimeUnit minusMonths( DateTimeUnit dateTimeUnit, int months ); @Override DateTimeUnit minusWeeks( DateTimeUnit dateTimeUnit, int weeks ); @Override DateTimeUnit minusDays( DateTimeUnit dateTimeUnit, int days ); @Override DateTimeUnit plusYears( DateTimeUnit dateTimeUnit, int years ); @Override DateTimeUnit plusMonths( DateTimeUnit dateTimeUnit, int months ); @Override DateTimeUnit plusWeeks( DateTimeUnit dateTimeUnit, int weeks ); @Override DateTimeUnit plusDays( DateTimeUnit dateTimeUnit, int days ); @Override DateTimeUnit isoStartOfYear( int year );  }
@Test public void testToInterval() { DateTimeUnit start = new DateTimeUnit( 1373, 6, 1, java.util.Calendar.FRIDAY ); DateInterval interval = calendar.toInterval( start, DateIntervalType.ISO8601_DAY, 0, 10 ); assertEquals( 1994, interval.getTo().getYear() ); assertEquals( 9, interval.getTo().getMonth() ); assertEquals( 2, interval.getTo().getDay() ); }