PersianCalendar extends AbstractCalendar { @Override public DateTimeUnit isoStartOfYear( int year ) { int day = 21; int[] twenties = new int[]{ 1375, 1379, 1383, 1387, 1391, 1395, 1399, 1403, 1407, 1408, 1411, 1412, 1415, 1416, 1419 }; if ( contains( twenties, year ) ) { day = 20; } return new DateTimeUnit( year + 621, 3, day, java.util.Calendar.FRIDAY, true ); }  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 testIsoStartOfYear() { DateTimeUnit startOfYear = calendar.isoStartOfYear( 1383 ); assertEquals( 2004, startOfYear.getYear() ); assertEquals( 3, startOfYear.getMonth() ); assertEquals( 20, startOfYear.getDay() ); startOfYear = calendar.isoStartOfYear( 1409 ); assertEquals( 2030, startOfYear.getYear() ); assertEquals( 3, startOfYear.getMonth() ); assertEquals( 21, startOfYear.getDay() ); }