[PATCH] The existing implementation respects the fact that months are 0-based
Wald Commits
scm-commit at wald.intevation.org
Wed Sep 3 18:21:50 CEST 2014
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1409761295 -7200
# Node ID 00066d3add945ad4d9199bd4be2250df7ac79dda
# Parent 705f8b92fd668a96dc29e88027362d38f0a4bd0f
The existing implementation respects the fact that months are 0-based.
diff -r 705f8b92fd66 -r 00066d3add94 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataValueFilter.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataValueFilter.java Wed Sep 03 16:46:09 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadDataValueFilter.java Wed Sep 03 18:21:35 2014 +0200
@@ -12,6 +12,8 @@
import java.util.Date;
import java.util.List;
+import org.dive4elements.river.utils.DateUtil;
+
import org.dive4elements.river.artifacts.model.minfo.SedimentLoadData.Value;
import org.dive4elements.river.artifacts.model.minfo.SedimentLoadData.Value.Filter;
@@ -131,20 +133,8 @@
}
public TimeRangeIntersects(int startYear, int endYear) {
- this(firstJan(Math.min(startYear, endYear)),
- lastDec(Math.max(startYear, endYear)));
- }
-
- private static Date firstJan(int year) {
- Calendar cal = Calendar.getInstance();
- cal.set(year, 1, 1, 0, 0, 0);
- return cal.getTime();
- }
-
- private static Date lastDec(int year) {
- Calendar cal = Calendar.getInstance();
- cal.set(year, 12, 31, 23, 59, 59);
- return cal.getTime();
+ this(DateUtil.getStartDateFromYear(Math.min(startYear, endYear)),
+ DateUtil.getEndDateFromYear(Math.max(startYear, endYear)));
}
public TimeRangeIntersects(Date a, Date b) {
More information about the Dive4Elements-commits
mailing list