dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #38979
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 19788: minor, add Calendar.startOfYear
------------------------------------------------------------
revno: 19788
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-08-19 14:55:34 +0700
message:
minor, add Calendar.startOfYear
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/impl/NepaliCalendar.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 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/AbstractCalendar.java 2015-08-19 07:55:34 +0000
@@ -257,4 +257,10 @@
{
return false;
}
+
+ @Override
+ public DateTimeUnit startOfYear()
+ {
+ return new DateTimeUnit( 0, 1, 1 );
+ }
}
=== 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 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/Calendar.java 2015-08-19 07:55:34 +0000
@@ -400,4 +400,11 @@
* @return is iso8601 based
*/
boolean isIso8601();
+
+ /**
+ * Get start of year as month/day, important especially for Nepali calendar
+ *
+ * @return
+ */
+ DateTimeUnit startOfYear();
}
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/NepaliCalendar.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/NepaliCalendar.java 2015-01-17 07:41:26 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/calendar/impl/NepaliCalendar.java 2015-08-19 07:55:34 +0000
@@ -483,6 +483,12 @@
return new DateTimeUnit( curYear, curMonth, curDay, dayOfWeek );
}
+ @Override
+ public DateTimeUnit startOfYear()
+ {
+ return startIso;
+ }
+
// check if day is more than current maximum for month, don't overflow, just set to maximum
// set day of week
private void updateDateUnit( DateTimeUnit result )