Browse Source

fixed daylight saving time bug

tags/v1.0.0
Robin Thoni 8 years ago
parent
commit
38907ccca7

+ 3
- 1
app/src/main/java/com/rthoni/stssaguenay/ui/fragments/HomeFragment.java View File

@@ -28,6 +28,7 @@ import org.joda.time.DateTimeZone;
28 28
 import org.joda.time.LocalDateTime;
29 29
 
30 30
 import java.util.Collections;
31
+import java.util.Date;
31 32
 import java.util.List;
32 33
 import java.util.TimeZone;
33 34
 import java.util.Vector;
@@ -210,7 +211,8 @@ public class HomeFragment extends Fragment {
210 211
     {
211 212
         _swipeRefreshLayout.setRefreshing(true);
212 213
         _adapter.setSchedules(null);
213
-        DateTimeZone dtz = DateTimeZone.forOffsetMillis(TimeZone.getDefault().getRawOffset() + TimeZone.getDefault().getDSTSavings());
214
+        TimeZone tz = TimeZone.getDefault();
215
+        DateTimeZone dtz = DateTimeZone.forOffsetMillis(tz.getRawOffset() + (tz.inDaylightTime(new Date()) ? tz.getDSTSavings() : 0));
214 216
         LocalDateTime date = LocalDateTime.now(dtz).plusMinutes(-30);
215 217
 
216 218
         SchedulesBusiness.getMultiple(STSBusiness.getConfig(getContext()), _adapter.getFavourites(), date, 10)

Loading…
Cancel
Save