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
 import org.joda.time.LocalDateTime;
28
 import org.joda.time.LocalDateTime;
29
 
29
 
30
 import java.util.Collections;
30
 import java.util.Collections;
31
+import java.util.Date;
31
 import java.util.List;
32
 import java.util.List;
32
 import java.util.TimeZone;
33
 import java.util.TimeZone;
33
 import java.util.Vector;
34
 import java.util.Vector;
210
     {
211
     {
211
         _swipeRefreshLayout.setRefreshing(true);
212
         _swipeRefreshLayout.setRefreshing(true);
212
         _adapter.setSchedules(null);
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
         LocalDateTime date = LocalDateTime.now(dtz).plusMinutes(-30);
216
         LocalDateTime date = LocalDateTime.now(dtz).plusMinutes(-30);
215
 
217
 
216
         SchedulesBusiness.getMultiple(STSBusiness.getConfig(getContext()), _adapter.getFavourites(), date, 10)
218
         SchedulesBusiness.getMultiple(STSBusiness.getConfig(getContext()), _adapter.getFavourites(), date, 10)

Loading…
Cancel
Save