瀏覽代碼

fixed daylight saving time bug

tags/v1.0.0
Robin Thoni 8 年之前
父節點
當前提交
38907ccca7
共有 1 個檔案被更改,包括 3 行新增1 行删除
  1. 3
    1
      app/src/main/java/com/rthoni/stssaguenay/ui/fragments/HomeFragment.java

+ 3
- 1
app/src/main/java/com/rthoni/stssaguenay/ui/fragments/HomeFragment.java 查看文件

@@ -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…
取消
儲存