roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r382261 - in /incubator/roller/trunk/src/org/roller/presentation: RollerRequest.java velocity/PageModel.java
Date Thu, 02 Mar 2006 03:19:39 GMT
Author: snoopdave
Date: Wed Mar  1 19:19:37 2006
New Revision: 382261

URL: http://svn.apache.org/viewcvs?rev=382261&view=rev
Log:
Fix for timezone and start/end of day logic

Modified:
    incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java
    incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java

Modified: incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java?rev=382261&r1=382260&r2=382261&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/RollerRequest.java Wed Mar  1 19:19:37
2006
@@ -850,8 +850,8 @@
             Date today = getToday();
             if (ret.after(today)) ret = today;
             
-            // since a specific date was requested set time to end of day
-            ret = DateUtil.getEndOfDay(ret);
+            // Do this later, once we know what timezone to use 
+            // ret = DateUtil.getEndOfDay(ret);
         } 
         if (   dateString!=null 
             && dateString.length()==6
@@ -864,8 +864,8 @@
             Date today = getToday();
             if (ret.after(today)) ret = today;
             
-            // since a specific date was requested set time to end of day
-            ret = DateUtil.getEndOfMonth(ret); 
+            // Do this later, once we know what timezone to use 
+            // ret = DateUtil.getEndOfMonth(ret); 
         }
         return ret;
     }

Modified: incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java
URL: http://svn.apache.org/viewcvs/incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java?rev=382261&r1=382260&r2=382261&view=diff
==============================================================================
--- incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java (original)
+++ incubator/roller/trunk/src/org/roller/presentation/velocity/PageModel.java Wed Mar  1
19:19:37 2006
@@ -1,6 +1,7 @@
 package org.roller.presentation.velocity;
 
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
@@ -8,6 +9,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.TimeZone;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -321,6 +323,13 @@
                 }
             }
             
+            Calendar cal = null;
+            if (mRollerReq.getWebsite() != null) {
+                TimeZone tz = mRollerReq.getWebsite().getTimeZoneInstance();
+                cal = Calendar.getInstance(tz);
+            } else {
+                cal = Calendar.getInstance();
+            }
             Integer limit = new Integer(maxEntries);
             Date startDate = null;
             Date endDate = mRollerReq.getDate();
@@ -328,12 +337,12 @@
             if (mRollerReq.isDaySpecified()) { 
                 // URL specified a specific day
                 // so get entries for that day
-                endDate = DateUtil.getEndOfDay(endDate);
-                startDate = DateUtil.getStartOfDay(endDate); 
+                endDate = DateUtil.getEndOfDay(endDate, cal);
+                startDate = DateUtil.getStartOfDay(endDate, cal); 
                 // and get them ALL, no limit
                 limit = null;                  
             } else if (mRollerReq.isMonthSpecified()) {
-                endDate = DateUtil.getEndOfDay(endDate);
+                endDate = DateUtil.getEndOfDay(endDate, cal);
             }
             Map mRet = RollerFactory.getRoller().getWeblogManager().getWeblogEntryObjectMap(
                     mRollerReq.getWebsite(),
@@ -354,7 +363,7 @@
                 List entries = (List) mRet.get(key);
                 for(int i=0; i < entries.size(); i++) {
                     wrappedEntries.add(i,
-                            WeblogEntryDataWrapper.wrap((WeblogEntryData)entries.get(i)));
+                         WeblogEntryDataWrapper.wrap((WeblogEntryData)entries.get(i)));
                 }
                 mRet.put(key, wrappedEntries);
             }



Mime
View raw message