You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2009/08/05 01:38:56 UTC

svn commit: r801023 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java

Author: adrianc
Date: Tue Aug  4 23:38:55 2009
New Revision: 801023

URL: http://svn.apache.org/viewvc?rev=801023&view=rev
Log:
Fixed a bug in UtilDateTime.java - getWeekEnd() returned the wrong value.

Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java?rev=801023&r1=801022&r2=801023&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilDateTime.java Tue Aug  4 23:38:55 2009
@@ -851,14 +851,10 @@
     }
 
     public static Timestamp getWeekEnd(Timestamp stamp, TimeZone timeZone, Locale locale) {
-        Calendar tempCal = toCalendar(stamp, timeZone, locale);
-        tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
-        tempCal.add(Calendar.WEEK_OF_MONTH, 1);
-        tempCal.set(Calendar.DAY_OF_WEEK, tempCal.getFirstDayOfWeek());
-        tempCal.add(Calendar.SECOND, -1);
-        Timestamp retStamp = new Timestamp(tempCal.getTimeInMillis());
-        retStamp.setNanos(999999999);
-        return retStamp;
+    	Timestamp weekStart = getWeekStart(stamp, timeZone, locale);
+        Calendar tempCal = toCalendar(weekStart, timeZone, locale);
+        tempCal.add(Calendar.DAY_OF_MONTH, 6);
+        return getDayEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale);
     }
 
     public static Timestamp getMonthStart(Timestamp stamp, TimeZone timeZone, Locale locale) {