=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-04-25 06:29:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-04-25 07:33:35 +0000 @@ -41,6 +41,10 @@ DateUnit fromIso( DateUnit dateUnit ); + DateInterval toIsoInterval( int year ); + + DateInterval toIsoInterval( int year, int month ); + DateUnit today(); int monthsInYear(); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java 2014-04-25 06:37:41 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java 2014-04-25 07:33:35 +0000 @@ -61,6 +61,30 @@ } @Override + public DateInterval toIsoInterval( int year ) + { + DateUnit from = new DateUnit( year, 1, 1 ); + DateUnit to = new DateUnit( year, monthsInYear(), daysInMonth( year, monthsInYear() ) ); + + from.setDayOfWeek( isoWeekday( from ) ); + to.setDayOfWeek( isoWeekday( to ) ); + + return new DateInterval( from, to ); + } + + @Override + public DateInterval toIsoInterval( int year, int month ) + { + DateUnit from = new DateUnit( year, month, 1 ); + DateUnit to = new DateUnit( year, month, daysInMonth( year, month ) ); + + from.setDayOfWeek( isoWeekday( from ) ); + to.setDayOfWeek( isoWeekday( to ) ); + + return new DateInterval( from, to ); + } + + @Override public int monthsInYear() { DateTime dateTime = new DateTime( 1, 1, 1, 0, 0, chronology ); === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/NepaliCalendar.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/NepaliCalendar.java 2014-04-25 06:29:27 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/NepaliCalendar.java 2014-04-25 07:33:35 +0000 @@ -121,6 +121,30 @@ } @Override + public DateInterval toIsoInterval( int year ) + { + DateUnit from = new DateUnit( year, 1, 1 ); + DateUnit to = new DateUnit( year, monthsInYear(), daysInMonth( year, monthsInYear() ) ); + + from = toIso( from ); + to = toIso( to ); + + return new DateInterval( from, to ); + } + + @Override + public DateInterval toIsoInterval( int year, int month ) + { + DateUnit from = new DateUnit( year, month, 1 ); + DateUnit to = new DateUnit( year, month, daysInMonth( year, month ) ); + + from = toIso( from ); + to = toIso( to ); + + return new DateInterval( from, to ); + } + + @Override public int daysInYear( int year ) { return getYearTotal( year );