dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29981
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15204: minor bugfixes for Calendar
------------------------------------------------------------
revno: 15204
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-05-09 14:19:31 +0200
message:
minor bugfixes for Calendar
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2014-04-29 07:28:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2014-05-09 12:19:31 +0000
@@ -144,6 +144,12 @@
}
@Override
+ public DateInterval toInterval( DateIntervalType type )
+ {
+ return toInterval( today(), type );
+ }
+
+ @Override
public DateUnit today()
{
DateTime dateTime = DateTime.now( ISOChronology.getInstance() );
=== 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-29 07:28:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2014-05-09 12:19:31 +0000
@@ -124,6 +124,13 @@
DateInterval toInterval( DateUnit dateUnit, DateIntervalType type );
/**
+ * Gets interval of type based on todays date
+ * @return Interval for interval type based on dateUnit
+ * @see DateIntervalType
+ */
+ DateInterval toInterval( DateIntervalType type );
+
+ /**
* Gets current date as local DateUnit
* @return Today date as local DateUnit
*/
=== 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-27 02:45:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/ChronologyBasedCalendar.java 2014-05-09 12:19:31 +0000
@@ -85,7 +85,7 @@
from.setDayOfWeek( isoWeekday( from ) );
to.setDayOfWeek( isoWeekday( to ) );
- return new DateInterval( from, to, DateIntervalType.ISO8601_YEAR );
+ return new DateInterval( toIso( from ), toIso( to ), DateIntervalType.ISO8601_YEAR );
}
private DateInterval toMonthIsoInterval( DateUnit dateUnit )
@@ -96,7 +96,7 @@
from.setDayOfWeek( isoWeekday( from ) );
to.setDayOfWeek( isoWeekday( to ) );
- return new DateInterval( from, to, DateIntervalType.ISO8601_MONTH );
+ return new DateInterval( toIso( from ), toIso( to ), DateIntervalType.ISO8601_MONTH );
}
private DateInterval toWeekIsoInterval( DateUnit dateUnit )